mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-19 03:31:14 +02:00
52112: use '_normal -p subcmd' to complete only external command
This commit is contained in:
parent
9ff1b2810e
commit
c0caef5613
15 changed files with 28 additions and 16 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2023-09-04 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||||
|
|
||||||
|
* 52112: Completion/BSD/Command/_jexec,
|
||||||
|
Completion/Linux/Command/_chrt, Completion/Linux/Command/_cpupower,
|
||||||
|
Completion/Linux/Command/_ionice,Completion/Linux/Command/_setpriv,
|
||||||
|
Completion/Linux/Command/_sysstat, Completion/Unix/Command/_chroot,
|
||||||
|
Completion/Unix/Command/_mosh, Completion/Unix/Command/_route,
|
||||||
|
Completion/Unix/Command/_screen, Completion/Unix/Command/_script,
|
||||||
|
Completion/Unix/Command/_ssh, Completion/Unix/Command/_stdbuf,
|
||||||
|
Completion/Unix/Command/_timeout: use '_normal -p $service' to
|
||||||
|
complete only external commands
|
||||||
|
|
||||||
2023-09-03 Bart Schaefer <schaefer@zsh.org>
|
2023-09-03 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* users/29220: Src/Modules/param_private.c, Test/V10private.ztst:
|
* users/29220: Src/Modules/param_private.c, Test/V10private.ztst:
|
||||||
|
|
|
@ -6,7 +6,7 @@ _jexec_normal() {
|
||||||
# relative paths are relative to the jail's root
|
# relative paths are relative to the jail's root
|
||||||
path=( "$(_call_program paths jls -j $words[1] path)"/$^path )
|
path=( "$(_call_program paths jls -j $words[1] path)"/$^path )
|
||||||
shift 1 words; (( CURRENT-- ))
|
shift 1 words; (( CURRENT-- ))
|
||||||
_normal
|
_normal -p $service
|
||||||
}
|
}
|
||||||
|
|
||||||
_jexec() {
|
_jexec() {
|
||||||
|
|
|
@ -62,7 +62,7 @@ elif (( CURRENT == 1 )); then
|
||||||
else
|
else
|
||||||
shift words
|
shift words
|
||||||
(( CURRENT-- ))
|
(( CURRENT-- ))
|
||||||
_normal && ret=0
|
_normal -p $service && ret=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -95,7 +95,7 @@ case $state in
|
||||||
'-i+[measurement interval]:interval (seconds)'
|
'-i+[measurement interval]:interval (seconds)'
|
||||||
'-c[schedule on every core]'
|
'-c[schedule on every core]'
|
||||||
'-v[increase verbosity]'
|
'-v[increase verbosity]'
|
||||||
'*:::command: _normal'
|
'*:::command: _normal -p $service'
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -28,7 +28,7 @@ if [[ -n $state ]]; then
|
||||||
elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then
|
elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then
|
||||||
_message -e uids 'user id'
|
_message -e uids 'user id'
|
||||||
else
|
else
|
||||||
_normal && ret=0
|
_normal -p $service && ret=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ _arguments -C -S -s \
|
||||||
'--selinux-label[request a selinux label]:SELinux labels: ' \
|
'--selinux-label[request a selinux label]:SELinux labels: ' \
|
||||||
'--apparmor-profile[request an apparmor profile]:AppArmor profiles: ' \
|
'--apparmor-profile[request an apparmor profile]:AppArmor profiles: ' \
|
||||||
'--reset-env[set environment as for a classic login shell]' \
|
'--reset-env[set environment as for a classic login shell]' \
|
||||||
'*:::command:_normal' \
|
'*:::command: _normal -p $service' \
|
||||||
&& return 0
|
&& return 0
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
|
|
|
@ -130,7 +130,7 @@ _pidstat() {
|
||||||
_arguments -s : \
|
_arguments -s : \
|
||||||
'-C[filter tasks by string]:task filter' \
|
'-C[filter tasks by string]:task filter' \
|
||||||
'-d[report I/O statistics]' \
|
'-d[report I/O statistics]' \
|
||||||
'-e[execute specified program and monitor it with pidstat]:*::command: _normal' \
|
'-e[execute specified program and monitor it with pidstat]:*::command: _normal -p $service' \
|
||||||
'-H[display timestamp in seconds since the epoch]' \
|
'-H[display timestamp in seconds since the epoch]' \
|
||||||
'-h[display horizontally]' \
|
'-h[display horizontally]' \
|
||||||
'-I[divide CPU usage by number of processors]' \
|
'-I[divide CPU usage by number of processors]' \
|
||||||
|
|
|
@ -33,7 +33,7 @@ case $variant in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
args+=( '1:new root directory:_directories' '*:::command:_normal' )
|
args+=( '1:new root directory:_directories' '*::: : _normal -p $service' )
|
||||||
|
|
||||||
_arguments -s -S : $args && ret=0
|
_arguments -s -S : $args && ret=0
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ _arguments -C \
|
||||||
'(-)--help[display help information]' \
|
'(-)--help[display help information]' \
|
||||||
'(-)--version[display version information]' \
|
'(-)--version[display version information]' \
|
||||||
"--no-init[don't set terminal init string]" \
|
"--no-init[don't set terminal init string]" \
|
||||||
'--ssh=[specify ssh command to setup session]:ssh command:_normal' \
|
'--ssh=[specify ssh command to setup session]:ssh command: _cmdstring' \
|
||||||
'--port=[specify server-side port range]:port:_sequence -n 2 -s \: _ports' \
|
'--port=[specify server-side port range]:port:_sequence -n 2 -s \: _ports' \
|
||||||
'(-a -n)--predict=[control speculative local echo]:mode:(adaptive always never)' \
|
'(-a -n)--predict=[control speculative local echo]:mode:(adaptive always never)' \
|
||||||
'(--predict -n)-a[synonym for --predict=always]' \
|
'(--predict -n)-a[synonym for --predict=always]' \
|
||||||
|
@ -22,7 +22,7 @@ _arguments -C \
|
||||||
'--local[run mosh-server locally without using ssh]' \
|
'--local[run mosh-server locally without using ssh]' \
|
||||||
'--experimental-remote-ip=[select method for discovering remote IP address to use for mosh]:method:(local remote proxy)' \
|
'--experimental-remote-ip=[select method for discovering remote IP address to use for mosh]:method:(local remote proxy)' \
|
||||||
'1:remote host name:->userhost' \
|
'1:remote host name:->userhost' \
|
||||||
'*:::args:_normal' && ret=0
|
'*::: : _normal -p $service' && ret=0
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
userhost)
|
userhost)
|
||||||
|
|
|
@ -196,7 +196,7 @@ if [[ -n $state ]]; then
|
||||||
if [[ $line[1] = exec ]]; then
|
if [[ $line[1] = exec ]]; then
|
||||||
shift words
|
shift words
|
||||||
(( CURRENT-- ))
|
(( CURRENT-- ))
|
||||||
_normal
|
_normal -p $service && return
|
||||||
elif [[ $line[1] = (flush|monitor) ]]; then
|
elif [[ $line[1] = (flush|monitor) ]]; then
|
||||||
sequential=()
|
sequential=()
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -107,7 +107,7 @@ if [[ -n $state ]]; then
|
||||||
elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then
|
elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then
|
||||||
_message "no more parameters"
|
_message "no more parameters"
|
||||||
else
|
else
|
||||||
_normal
|
_normal -p $service
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
attached-sessions)
|
attached-sessions)
|
||||||
|
|
|
@ -68,7 +68,7 @@ case $OSTYPE in
|
||||||
'-F[send output to specified named pipe]:fifo:_files -g "*(p)"'
|
'-F[send output to specified named pipe]:fifo:_files -g "*(p)"'
|
||||||
'-t+[specify interval of data flushing]:interval (seconds)'
|
'-t+[specify interval of data flushing]:interval (seconds)'
|
||||||
'-k[log keys sent to the program as well as output]'
|
'-k[log keys sent to the program as well as output]'
|
||||||
'*:::arguments: _normal'
|
'*:::arguments: _normal $service'
|
||||||
)
|
)
|
||||||
;|
|
;|
|
||||||
darwin*|freebsd*)
|
darwin*|freebsd*)
|
||||||
|
|
|
@ -136,7 +136,7 @@ _ssh () {
|
||||||
'(-k -c)-s[force sh-style shell]' \
|
'(-k -c)-s[force sh-style shell]' \
|
||||||
'-t+[set default maximum lifetime for identities]: :_numbers -u seconds "maximum lifetime" \:s\:seconds m\:minutes h\:hours d\:days w\:weeks' \
|
'-t+[set default maximum lifetime for identities]: :_numbers -u seconds "maximum lifetime" \:s\:seconds m\:minutes h\:hours d\:days w\:weeks' \
|
||||||
'-v[verbose mode]' \
|
'-v[verbose mode]' \
|
||||||
'*::command: _normal'
|
'*::command: _normal -p $service'
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
ssh-keygen)
|
ssh-keygen)
|
||||||
|
@ -738,7 +738,7 @@ _ssh () {
|
||||||
local -a _comp_priv_prefix
|
local -a _comp_priv_prefix
|
||||||
shift 1 words
|
shift 1 words
|
||||||
(( CURRENT-- ))
|
(( CURRENT-- ))
|
||||||
_normal
|
_normal -p $service
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
destinations)
|
destinations)
|
||||||
|
|
|
@ -27,6 +27,6 @@ for ((i=1;i<=3;i++)); do
|
||||||
"(${short[i]})${long[i]}=${(e)opt}"
|
"(${short[i]})${long[i]}=${(e)opt}"
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
(( CURRENT > 2 )) && args+=( '*::command:_normal' )
|
(( CURRENT > 2 )) && args+=( '*::command: _normal -p $service' )
|
||||||
|
|
||||||
_arguments -s -S $args
|
_arguments -s -S $args
|
||||||
|
|
|
@ -17,4 +17,4 @@ _arguments -S -A "-" $args \
|
||||||
'(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \
|
'(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \
|
||||||
'(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time' \
|
'(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time' \
|
||||||
'1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \
|
'1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \
|
||||||
'*:::command:_normal'
|
'*:::command: _normal -p $service'
|
||||||
|
|
Loading…
Reference in a new issue