From: Leah Neukirchen Date: Mon, 31 Jan 2022 17:28:01 +0000 (+0100) Subject: scripts/completion.pl: improve zsh completion X-Git-Tag: curl-7_82_0~139 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=90c45813893fad5240db888fab3ff410b950151d;p=thirdparty%2Fcurl.git scripts/completion.pl: improve zsh completion - Detect all spellings of , etc as well as . - Only complete directories for . - Complete URLs for . - Complete --request and --ftp-method. Closes #8363 --- diff --git a/scripts/completion.pl b/scripts/completion.pl index 8bbf4838ab..299f86055c 100755 --- a/scripts/completion.pl +++ b/scripts/completion.pl @@ -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 '' || $arg eq '' - || $arg eq ''); + if (defined $arg) { + $option .= ":'$arg'"; + if ($arg =~ /|/) { + $option .= ':_files'; + } elsif ($arg =~ //) { + $option .= ":'_path_files -/'"; + } elsif ($arg =~ //i) { + $option .= ':_urls'; + } elsif ($long =~ /ftp/ && $arg =~ //) { + $option .= ":'(multicwd nocwd singlecwd)'"; + } elsif ($arg =~ //) { + $option .= ":'(DELETE GET HEAD POST PUT)'"; + } + } } push @list, $option;