1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-18 15:21:16 +02:00

52112: use '_normal -p subcmd' to complete only external command

This commit is contained in:
Jun-ichi Takimoto 2023-09-04 15:07:52 +09:00
parent 9ff1b2810e
commit c0caef5613
15 changed files with 28 additions and 16 deletions

View file

@ -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>
* users/29220: Src/Modules/param_private.c, Test/V10private.ztst:

View file

@ -6,7 +6,7 @@ _jexec_normal() {
# relative paths are relative to the jail's root
path=( "$(_call_program paths jls -j $words[1] path)"/$^path )
shift 1 words; (( CURRENT-- ))
_normal
_normal -p $service
}
_jexec() {

View file

@ -62,7 +62,7 @@ elif (( CURRENT == 1 )); then
else
shift words
(( CURRENT-- ))
_normal && ret=0
_normal -p $service && ret=0
fi
return ret

View file

@ -95,7 +95,7 @@ case $state in
'-i+[measurement interval]:interval (seconds)'
'-c[schedule on every core]'
'-v[increase verbosity]'
'*:::command: _normal'
'*:::command: _normal -p $service'
)
;;
esac

View file

@ -28,7 +28,7 @@ if [[ -n $state ]]; then
elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then
_message -e uids 'user id'
else
_normal && ret=0
_normal -p $service && ret=0
fi
fi

View file

@ -96,7 +96,7 @@ _arguments -C -S -s \
'--selinux-label[request a selinux label]:SELinux labels: ' \
'--apparmor-profile[request an apparmor profile]:AppArmor profiles: ' \
'--reset-env[set environment as for a classic login shell]' \
'*:::command:_normal' \
'*:::command: _normal -p $service' \
&& return 0
case $state in

View file

@ -130,7 +130,7 @@ _pidstat() {
_arguments -s : \
'-C[filter tasks by string]:task filter' \
'-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 horizontally]' \
'-I[divide CPU usage by number of processors]' \

View file

@ -33,7 +33,7 @@ case $variant in
;;
esac
args+=( '1:new root directory:_directories' '*:::command:_normal' )
args+=( '1:new root directory:_directories' '*::: : _normal -p $service' )
_arguments -s -S : $args && ret=0

View file

@ -7,7 +7,7 @@ _arguments -C \
'(-)--help[display help information]' \
'(-)--version[display version information]' \
"--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' \
'(-a -n)--predict=[control speculative local echo]:mode:(adaptive always never)' \
'(--predict -n)-a[synonym for --predict=always]' \
@ -22,7 +22,7 @@ _arguments -C \
'--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)' \
'1:remote host name:->userhost' \
'*:::args:_normal' && ret=0
'*::: : _normal -p $service' && ret=0
case $state in
userhost)

View file

@ -196,7 +196,7 @@ if [[ -n $state ]]; then
if [[ $line[1] = exec ]]; then
shift words
(( CURRENT-- ))
_normal
_normal -p $service && return
elif [[ $line[1] = (flush|monitor) ]]; then
sequential=()
fi

View file

@ -107,7 +107,7 @@ if [[ -n $state ]]; then
elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then
_message "no more parameters"
else
_normal
_normal -p $service
fi
;;
attached-sessions)

View file

@ -68,7 +68,7 @@ case $OSTYPE in
'-F[send output to specified named pipe]:fifo:_files -g "*(p)"'
'-t+[specify interval of data flushing]:interval (seconds)'
'-k[log keys sent to the program as well as output]'
'*:::arguments: _normal'
'*:::arguments: _normal $service'
)
;|
darwin*|freebsd*)

View file

@ -136,7 +136,7 @@ _ssh () {
'(-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' \
'-v[verbose mode]' \
'*::command: _normal'
'*::command: _normal -p $service'
return
;;
ssh-keygen)
@ -738,7 +738,7 @@ _ssh () {
local -a _comp_priv_prefix
shift 1 words
(( CURRENT-- ))
_normal
_normal -p $service
return
;;
destinations)

View file

@ -27,6 +27,6 @@ for ((i=1;i<=3;i++)); do
"(${short[i]})${long[i]}=${(e)opt}"
)
done
(( CURRENT > 2 )) && args+=( '*::command:_normal' )
(( CURRENT > 2 )) && args+=( '*::command: _normal -p $service' )
_arguments -s -S $args

View file

@ -17,4 +17,4 @@ _arguments -S -A "-" $args \
'(-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' \
'1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \
'*:::command:_normal'
'*:::command: _normal -p $service'