From 90c45813893fad5240db888fab3ff410b950151d Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 31 Jan 2022 18:28:01 +0100 Subject: [PATCH] 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 --- scripts/completion.pl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/completion.pl b/scripts/completion.pl index 8bbf4838a..299f86055 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;