From 7791a6876c64ee678da0bd9af954af692146f4fd Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 13 Dec 2021 20:59:25 +0100 Subject: 49645: when completing for the path_dirs option, add a / suffix and follow symlinks --- Completion/Unix/Type/_path_commands | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Completion/Unix/Type/_path_commands') diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands index 66795ae0f..4d5a6c5af 100644 --- a/Completion/Unix/Type/_path_commands +++ b/Completion/Unix/Type/_path_commands @@ -87,18 +87,19 @@ fi # 'if' block move up to the "_command_names -" branch of _command_names? if [[ -o path_dirs ]]; then local -a path_dirs - path_dirs=(${^path}/*(/N:t)) - (( ${#path_dirs} )) && - _wanted path-dirs expl 'directory in path' compadd "$@" -a path_dirs && ret=0 if [[ $PREFIX$SUFFIX = */* ]]; then + path_dirs=( ${path:#.} ) # Find command from path, not hashed - _wanted commands expl 'external command' _path_files -W path -g '*(*)' && - ret=0 + _wanted commands expl 'external command' _path_files -W path_dirs -g '*(-*)' && ret=0 + else + path_dirs=(${^path}/*(/N:t)) + (( ${#path_dirs} )) && + _wanted path-dirs expl 'directory in path' compadd "$@" -S / -a path_dirs && ret=0 fi fi -return $ret +return ret } _path_commands "$@" -- cgit 1.4.1