diff options
author | Oliver Kiddle <opk@zsh.org> | 2021-12-13 20:59:25 +0100 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2021-12-13 20:59:25 +0100 |
commit | 7791a6876c64ee678da0bd9af954af692146f4fd (patch) | |
tree | d0c46d020dc92c4ad6c4457a150c42382a98ac16 | |
parent | 78c51b34c026d295c146b01db3d534bc3cd9352b (diff) | |
download | zsh-7791a6876c64ee678da0bd9af954af692146f4fd.tar.gz zsh-7791a6876c64ee678da0bd9af954af692146f4fd.tar.xz zsh-7791a6876c64ee678da0bd9af954af692146f4fd.zip |
49645: when completing for the path_dirs option, add a / suffix and follow symlinks
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Completion/Unix/Type/_path_commands | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog index d6c748bd7..cb5d4564e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2021-12-13 Oliver Kiddle <opk@zsh.org> + * 49645: Completion/Unix/Type/_path_commands: when completing for + the path_dirs option, add a / suffix and follow symlinks + * 49643: Completion/Zsh/Type/_command_names: facilitate use of the fake style by always calling _description with the executables tag 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 "$@" |