From e295c455b2f43e5df49a8df9e7a3f3852cc29611 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 11 Nov 2025 13:20:01 +0200 Subject: [PATCH] remove deprecated argument options (`--level` and `-external` now driving by the `-match` rules), update `--follow` documentation --- README.md | 12 ++---------- help.gmi | 9 ++------- src/Model/Cli/Option.php | 10 ---------- src/Model/Filesystem.php | 3 --- src/gemini-dl.php | 4 +--- 5 files changed, 5 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 5908fcd..d1ed2fc 100755 --- a/README.md +++ b/README.md @@ -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` diff --git a/help.gmi b/help.gmi index 58506be..6bf048a 100755 --- a/help.gmi +++ b/help.gmi @@ -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 + -u, --unique - no value, append snap version as folder timestamp, disabled by default \ No newline at end of file diff --git a/src/Model/Cli/Option.php b/src/Model/Cli/Option.php index 2a8804f..fb20ea9 100755 --- a/src/Model/Cli/Option.php +++ b/src/Model/Cli/Option.php @@ -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 ); diff --git a/src/Model/Filesystem.php b/src/Model/Filesystem.php index e55155c..5043c73 100755 --- a/src/Model/Filesystem.php +++ b/src/Model/Filesystem.php @@ -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, diff --git a/src/gemini-dl.php b/src/gemini-dl.php index 939c322..8bae9ad 100755 --- a/src/gemini-dl.php +++ b/src/gemini-dl.php @@ -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:',