about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2021-12-13 20:52:23 +0100
committerOliver Kiddle <opk@zsh.org>2021-12-13 20:52:23 +0100
commit78c51b34c026d295c146b01db3d534bc3cd9352b (patch)
tree76c488a4c5a2fd4867cda64f1bfc80d3dc96d1bc /Completion
parent6de4bcfcd5b47bec5a8acbdd5a4514ea06c8ea90 (diff)
downloadzsh-78c51b34c026d295c146b01db3d534bc3cd9352b.tar.gz
zsh-78c51b34c026d295c146b01db3d534bc3cd9352b.tar.xz
zsh-78c51b34c026d295c146b01db3d534bc3cd9352b.zip
49643: facilitate use of the fake style by always calling _description with the executables tag for command names
Also allow the command-path style to include relative directories.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Zsh/Type/_command_names12
1 files changed, 8 insertions, 4 deletions
diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index b1c35f013..12cbd69c1 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -4,7 +4,7 @@
 # complete only external commands and executable files. This and a
 # `-' as the first argument is then removed from the arguments.
 
-local args defs ffilt
+local args defs expl ffilt
 
 zstyle -t ":completion:${curcontext}:commands" rehash && rehash
 
@@ -16,8 +16,12 @@ defs=(
   'commands:external command:_path_commands'
 )
 
-[[ -n "$path[(r).]" || $PREFIX = */* ]] &&
-    defs+=( 'executables:executable file:_files -g \*\(-\*\)' )
+if [[ -n "$path[(r).]" || $PREFIX = */* ]]; then
+  defs+=( 'executables:executable file:_files -g \*\(-\*\)' )
+else
+  # this is ignored but exists to facilitate the use of the fake style
+  _description executables expl 'executable file'
+fi
 
 if [[ "$1" = -e ]]; then
   shift
@@ -58,7 +62,7 @@ fi
 if (( $#cmdpath )); then
   local -a +h path
   local -A +h commands
-  path=( $cmdpath )
+  path=( $cmdpath:A )
 fi
 
 _alternative -O args "$defs[@]"