2005-09-20 21:31:55 +08:00
|
|
|
# Completions for the kill command
|
|
|
|
|
2006-12-01 00:32:30 +08:00
|
|
|
set -l signals
|
|
|
|
|
2005-09-20 21:31:55 +08:00
|
|
|
if kill -L ^/dev/null >/dev/null
|
|
|
|
|
|
|
|
# Debian and some related systems use 'kill -L' to write out a numbered list
|
|
|
|
# of signals. Use this to complete on both number _and_ on signal name.
|
|
|
|
|
2006-12-01 00:32:30 +08:00
|
|
|
complete -c kill -s L -d (N_ "List codes and names of available signals")
|
2005-09-20 21:31:55 +08:00
|
|
|
|
2006-12-13 04:37:27 +08:00
|
|
|
set signals (kill -L | sed -e 's/\([0-9][0-9]*\) *\([A-Z,0-9][A-Z,0-9]*\)/\1 \2\n/g;s/ +/ /g' | sed -e 's/^ //' | sgrep -E '^[^ ]+')
|
2005-09-20 21:31:55 +08:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2006-12-01 00:32:30 +08:00
|
|
|
# Posix systems print out the name of a signal using 'kill -l
|
|
|
|
# SIGNUM', so we use this instead.
|
2005-09-20 21:31:55 +08:00
|
|
|
|
2006-12-01 00:32:30 +08:00
|
|
|
complete -c kill -s l -d (N_ "List names of available signals")
|
2005-09-20 21:31:55 +08:00
|
|
|
|
2006-12-01 00:32:30 +08:00
|
|
|
for i in (seq 31)
|
|
|
|
set signals $signals $i" "(kill -l $i)
|
2005-09-20 21:31:55 +08:00
|
|
|
end
|
2006-12-01 00:32:30 +08:00
|
|
|
|
2005-09-20 21:31:55 +08:00
|
|
|
end
|
|
|
|
|
2006-12-01 00:32:30 +08:00
|
|
|
for i in $signals
|
2006-12-13 04:37:27 +08:00
|
|
|
set number (echo $i | cut -d " " -f 1)
|
|
|
|
set name (echo $i | cut -d " " -f 2)
|
2006-12-01 00:32:30 +08:00
|
|
|
complete -c kill -o $number -d $name
|
|
|
|
complete -c kill -o $name -d $name
|
|
|
|
complete -c kill -o s -x -a \"$number\tSend\ $name\ signal\"
|
|
|
|
complete -c kill -o s -x -a \"$name\tSend\ $name\ signal\"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2005-11-03 00:49:13 +08:00
|
|
|
complete -c kill -xa '(__fish_complete_pids)'
|
2005-09-20 21:31:55 +08:00
|
|
|
|