mirror of
https://github.com/curl/curl.git
synced 2024-12-09 06:30:06 +08:00
scripts/completion.pl: improve zsh completion
- Detect all spellings of <file>, <file name> etc as well as <path>. - Only complete directories for <dir>. - Complete URLs for <URL>. - Complete --request and --ftp-method. Closes #8363
This commit is contained in:
parent
9cc75eb7dd
commit
90c4581389
@ -102,11 +102,20 @@ sub parse_main_opts {
|
||||
$option .= '}' if defined $short;
|
||||
$option .= '\'[' . trim($desc) . ']\'' if defined $desc;
|
||||
|
||||
$option .= ":'$arg'" if defined $arg;
|
||||
|
||||
$option .= ':_files'
|
||||
if defined $arg and ($arg eq '<file>' || $arg eq '<filename>'
|
||||
|| $arg eq '<dir>');
|
||||
if (defined $arg) {
|
||||
$option .= ":'$arg'";
|
||||
if ($arg =~ /<file ?(name)?>|<path>/) {
|
||||
$option .= ':_files';
|
||||
} elsif ($arg =~ /<dir>/) {
|
||||
$option .= ":'_path_files -/'";
|
||||
} elsif ($arg =~ /<url>/i) {
|
||||
$option .= ':_urls';
|
||||
} elsif ($long =~ /ftp/ && $arg =~ /<method>/) {
|
||||
$option .= ":'(multicwd nocwd singlecwd)'";
|
||||
} elsif ($arg =~ /<method>/) {
|
||||
$option .= ":'(DELETE GET HEAD POST PUT)'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
push @list, $option;
|
||||
|
Loading…
Reference in New Issue
Block a user