mirror of
https://github.com/YGGverse/gemini-dl.git
synced 2026-03-31 09:05:31 +00:00
remove deprecated argument options (--level and -external now driving by the -match rules), update --follow documentation
This commit is contained in:
parent
d9db0ad7e9
commit
e295c455b2
5 changed files with 5 additions and 33 deletions
12
README.md
12
README.md
|
|
@ -32,10 +32,8 @@ At this moment, project under development, some [features](#features) already im
|
||||||
* [x] Original (`--keep`)
|
* [x] Original (`--keep`)
|
||||||
* [x] `--match` regex URL
|
* [x] `--match` regex URL
|
||||||
* [x] `--unique` snap version or sync with existing copy
|
* [x] `--unique` snap version or sync with existing copy
|
||||||
* [ ] Configurable redirect levels to `--follow`
|
* [x] Configurable redirect levels to `--follow`
|
||||||
* [ ] Crawl depth `--level` limit
|
|
||||||
* [ ] Document size limit to download
|
* [ ] Document size limit to download
|
||||||
* [ ] Follow `--external` links on crawl
|
|
||||||
|
|
||||||
## Environment
|
## 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
|
-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
|
-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
|
-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
|
-i, --index - string, index filename of directory listing, index.gmi by default
|
||||||
-h, --help - no value, show available commands
|
-h, --help - no value, show available commands
|
||||||
-k, --keep - no value, keep original links (--crawl mode only), disabled by default
|
-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
|
-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
|
-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`
|
* show in CLI: `gemini-dl.php --help`
|
||||||
|
|
|
||||||
7
help.gmi
7
help.gmi
|
|
@ -20,15 +20,10 @@
|
||||||
-a, --absolute - no value, links to absolute filepath (ignored on --keep), disabled by default
|
-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
|
-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
|
-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
|
-i, --index - string, index filename of directory listing, index.gmi by default
|
||||||
-h, --help - no value, show available commands
|
-h, --help - no value, show available commands
|
||||||
-k, --keep - no value, keep original links (--crawl mode only), disabled by default
|
-k, --keep - no value, keep original links (--crawl mode only), disabled by default
|
||||||
-m, --match - string, collect links match regex rule, /.*/ 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
|
-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
|
-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
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ class Option
|
||||||
public bool $absolute = false;
|
public bool $absolute = false;
|
||||||
public bool $crawl = false;
|
public bool $crawl = false;
|
||||||
public int $delay = 1;
|
public int $delay = 1;
|
||||||
public bool $external = false;
|
|
||||||
public int $follow = 5;
|
public int $follow = 5;
|
||||||
public bool $help = false;
|
public bool $help = false;
|
||||||
public string $index = 'index.gmi';
|
public string $index = 'index.gmi';
|
||||||
public bool $keep = false;
|
public bool $keep = false;
|
||||||
public int $level = 0;
|
|
||||||
public string $match = '/.*/';
|
public string $match = '/.*/';
|
||||||
public bool $raw = false;
|
public bool $raw = false;
|
||||||
public string $source;
|
public string $source;
|
||||||
|
|
@ -45,10 +43,6 @@ class Option
|
||||||
$options['delay'] ?? $options['d'] ?? $this->delay
|
$options['delay'] ?? $options['d'] ?? $this->delay
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->external = boolval(
|
|
||||||
isset($options['external']) || isset($options['e']) || $this->external
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->follow = intval(
|
$this->follow = intval(
|
||||||
$options['follow'] ?? $options['f'] ?? $this->follow
|
$options['follow'] ?? $options['f'] ?? $this->follow
|
||||||
);
|
);
|
||||||
|
|
@ -65,10 +59,6 @@ class Option
|
||||||
isset($options['keep']) || isset($options['k']) || $this->keep
|
isset($options['keep']) || isset($options['k']) || $this->keep
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->level = intval(
|
|
||||||
$options['level'] ?? $options['l'] ?? $this->level
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->match = strval(
|
$this->match = strval(
|
||||||
$options['match'] ?? $options['m'] ?? $this->match
|
$options['match'] ?? $options['m'] ?? $this->match
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -204,9 +204,6 @@ class Filesystem
|
||||||
*
|
*
|
||||||
* Method does not and must not check location for exist
|
* Method does not and must not check location for exist
|
||||||
* $filename and $dirname must contain --target defined.
|
* $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(
|
public function getFilenameRelativeToDirname(
|
||||||
string $filename,
|
string $filename,
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,15 @@ try
|
||||||
// Start application
|
// Start application
|
||||||
$cli = new Cli(
|
$cli = new Cli(
|
||||||
getopt(
|
getopt(
|
||||||
'acd:ef:hi:kl:m:rs:t:u',
|
'acd:f:hi:k:m:rs:t:u',
|
||||||
[
|
[
|
||||||
'absolute:',
|
'absolute:',
|
||||||
'crawl:',
|
'crawl:',
|
||||||
'delay:',
|
'delay:',
|
||||||
'external',
|
|
||||||
'follow:',
|
'follow:',
|
||||||
'help',
|
'help',
|
||||||
'index:',
|
'index:',
|
||||||
'keep',
|
'keep',
|
||||||
'level:',
|
|
||||||
'match:',
|
'match:',
|
||||||
'raw',
|
'raw',
|
||||||
'source:',
|
'source:',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue