remove deprecated argument options (--level and -external now driving by the -match rules), update --follow documentation

This commit is contained in:
yggverse 2025-11-11 13:20:01 +02:00
parent d9db0ad7e9
commit e295c455b2
5 changed files with 5 additions and 33 deletions

View file

@ -32,10 +32,8 @@ At this moment, project under development, some [features](#features) already im
* [x] Original (`--keep`)
* [x] `--match` regex URL
* [x] `--unique` snap version or sync with existing copy
* [ ] Configurable redirect levels to `--follow`
* [ ] Crawl depth `--level` limit
* [x] Configurable redirect levels to `--follow`
* [ ] Document size limit to download
* [ ] Follow `--external` links on crawl
## Environment
@ -71,6 +69,7 @@ src/gemini-dl.php --source gemini://.. --target /path/to/download
-a, --absolute - no value, links to absolute filepath (ignored on --keep), disabled by default
-c, --crawl - no value, crawl document links (entire capsule download), disabled by default
-d, --delay - integer, pause between requests to prevent abuse (seconds), 1 by default
-f, --follow - integer, follow redirects on --crawl, 0 by default
-i, --index - string, index filename of directory listing, index.gmi by default
-h, --help - no value, show available commands
-k, --keep - no value, keep original links (--crawl mode only), disabled by default
@ -78,11 +77,4 @@ src/gemini-dl.php --source gemini://.. --target /path/to/download
-r, --raw - no value, include meta headers (--keep option ignored), disabled by default
-u, --unique - no value, append snap version as folder timestamp, disabled by default
# Experimental (in development)
-e, --external - no value, follow external hosts, disabled by default
-f, --follow - integer, follow redirects on --crawl, 0 by default
-l, --level - integer, depth to --crawl, 0 by default
```
* show in CLI: `gemini-dl.php --help`

View file

@ -20,15 +20,10 @@
-a, --absolute - no value, links to absolute filepath (ignored on --keep), disabled by default
-c, --crawl - no value, crawl document links (entire capsule download), disabled by default
-d, --delay - integer, pause between requests to prevent abuse (seconds), 1 by default
-f, --follow - integer, follow redirects on --crawl, 0 by default
-i, --index - string, index filename of directory listing, index.gmi by default
-h, --help - no value, show available commands
-k, --keep - no value, keep original links (--crawl mode only), disabled by default
-m, --match - string, collect links match regex rule, /.*/ by default
-r, --raw - no value, include meta headers (--keep option ignored), disabled by default
-u, --unique - no value, append snap version as folder timestamp, disabled by default
## Experimental (in development)
-e, --external - no value, follow external hosts, disabled by default
-f, --follow - integer, follow redirects on --crawl, 0 by default
-l, --level - integer, depth to --crawl, 0 by default

View file

@ -9,12 +9,10 @@ class Option
public bool $absolute = false;
public bool $crawl = false;
public int $delay = 1;
public bool $external = false;
public int $follow = 5;
public bool $help = false;
public string $index = 'index.gmi';
public bool $keep = false;
public int $level = 0;
public string $match = '/.*/';
public bool $raw = false;
public string $source;
@ -45,10 +43,6 @@ class Option
$options['delay'] ?? $options['d'] ?? $this->delay
);
$this->external = boolval(
isset($options['external']) || isset($options['e']) || $this->external
);
$this->follow = intval(
$options['follow'] ?? $options['f'] ?? $this->follow
);
@ -65,10 +59,6 @@ class Option
isset($options['keep']) || isset($options['k']) || $this->keep
);
$this->level = intval(
$options['level'] ?? $options['l'] ?? $this->level
);
$this->match = strval(
$options['match'] ?? $options['m'] ?? $this->match
);

View file

@ -204,9 +204,6 @@ class Filesystem
*
* Method does not and must not check location for exist
* $filename and $dirname must contain --target defined.
*
* This implementation compatible with --external option
* resulting path get format: ../domain.com/path/to/file
*/
public function getFilenameRelativeToDirname(
string $filename,

View file

@ -15,17 +15,15 @@ try
// Start application
$cli = new Cli(
getopt(
'acd:ef:hi:kl:m:rs:t:u',
'acd:f:hi:k:m:rs:t:u',
[
'absolute:',
'crawl:',
'delay:',
'external',
'follow:',
'help',
'index:',
'keep',
'level:',
'match:',
'raw',
'source:',