aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions
diff options
context:
space:
mode:
authorGravatar lordlycastle <lordlycastle@hotmail.com>2015-12-17 02:37:01 +0100
committerGravatar Fabian Homborg <FHomborg@gmail.com>2015-12-28 12:54:13 +0100
commitf23c2beb61075f9805347a84c8335ce1348e3d6d (patch)
treec90b6a1a9bc8fd6d74c1cb298fc4ecafcefd5685 /share/completions
parent994aba075d0663869a7f404d8015cb9f0282589d (diff)
Fixed kill-signals completion. Added completions for OS X kill command.
Don't generate killall completions when running on Solaris OS - `killall` there literally kills all processes.
Diffstat (limited to 'share/completions')
-rw-r--r--share/completions/kill.fish17
-rw-r--r--share/completions/killall.fish64
2 files changed, 62 insertions, 19 deletions
diff --git a/share/completions/kill.fish b/share/completions/kill.fish
index 955795fb..81eff965 100644
--- a/share/completions/kill.fish
+++ b/share/completions/kill.fish
@@ -4,10 +4,21 @@ for i in $__kill_signals
set number (echo $i | cut -d " " -f 1)
set name (echo $i | cut -d " " -f 2)
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\"
+ complete -c kill -o $name
+ complete -c kill -s s -x -a "$number $name"
end
complete -c kill -xa '(__fish_complete_pids)'
+if kill -L > /dev/null ^ /dev/null
+ complete -c kill -s s -l signal -d "Signal to send"
+ complete -c kill -s l -l list -d "Printf list of signal names, or name of given SIG NUMBER"
+ complete -c kill -s L -l table -d " Print signal names and their corresponding numbers"
+ complete -c kill -s a -l all -d "Do not restrict the commandname-to-pid conversion to processes with the same uid as the present process"
+ complete -c kill -s p -l pid -d "Only print pid of the named processes, do not send any signals"
+ complete -c kill -s q -l queue -d "Use sigqueue(2) rather than kill(2). The value argument is an integer that is sent along with the signal."
+ complete -c kill -l verbos -d "Print pid(s) that will be signaled with kill along with the signal."
+else # OS X
+ complete -c kill -s s -d "Signal to send"
+ complete -c kill -s l -d "Printf list of signal names, or name of given SIG NUMBER"
+end \ No newline at end of file
diff --git a/share/completions/killall.fish b/share/completions/killall.fish
index ae70c900..4bf4236f 100644
--- a/share/completions/killall.fish
+++ b/share/completions/killall.fish
@@ -1,20 +1,52 @@
-__fish_make_completion_signals
+# For Solaris OS, we don't need to generate completions. Since it can hang the PC.
+if test (uname) != 'SunOS'
+ __fish_make_completion_signals
-for i in $__kill_signals
- set number (echo $i | cut -d " " -f 1)
- set name (echo $i | cut -d " " -f 2)
- complete -c killall -o $number -d $name
- complete -c killall -o $name -d $name
- complete -c killall -o s -x -a \"$number\tSend\ $name\ signal\"
- complete -c killall -o s -x -a \"$name\tSend\ $name\ signal\"
-end
+ for i in $__kill_signals
+ set number (echo $i | cut -d " " -f 1)
+ set name (echo $i | cut -d " " -f 2)
+ complete -c killall -o $number -d $name
+ complete -c killall -o $name
+ # Doesn't work in OS X; -s is simulate
+ test (uname) != 'Darwin'; and complete -c killall -s s -x -a "$number $name"
+ end
-complete -c killall -xa '(__fish_complete_proc)'
-complete -c killall -s e -l exact -d 'Require an exact match for very long names'
-complete -c killall -s I -l ignore-case -d 'Do case insensitive process name match'
-complete -c killall -s g -l process-group -d 'Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found'
-complete -c killall -s i -l interactive -d 'Interactively ask for confirmation before killing'
-complete -c killall -s u -l user -d 'Kill only processes the specified user owns. Command names are optional'
-complete -c killall -s w -l wait -d 'Wait for all killed processes to die. killall checks once per second if any of the killed processes still exist and only returns if none are left. Note that killall may wait forever if the signal was ignored, had no effect, or if the process stays in zombie state'
+ # Finds and completes all users, and their respective UID.
+ function __make_users_completions
+ set -l users (dscl . list /Users | grep -v '^_.*')
+ for user in $users
+ set -l uid (id -u $user)
+ # GNU doesn't support UID
+ killall --version > /dev/null ^ /dev/null; and set -el uid
+ complete -c killall -s u -x -a "$user $uid" -d "Match only processes belonging to $user"
+ end
+ end
+ complete -c killall -xa '(__fish_complete_proc)'
+ if killall --version > /dev/null ^ /dev/null
+ complete -c killall -s e -l exact -d 'Require an exact match for very long names'
+ complete -c killall -s I -l ignore-case -d 'Do case insensitive process name match'
+ complete -c killall -s g -l process-group -d 'Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found'
+ complete -c killall -s i -l interactive -d 'Interactively ask for confirmation before killing'
+ complete -c killall -s u -l user -d 'Kill only processes the specified user owns. Command names are optional' -x
+ __make_users_completions
+ complete -c killall -s w -l wait -d 'Wait for all killed processes to die. killall checks once per second if any of the killed processes still exist and only returns if none are left. Note that killall may wait forever if the signal was ignored, had no effect, or if the process stays in zombie state'
+ complete -c killall -s v -l version -d 'Print version'
+ else
+ complete -c killall -s v -d 'Be more verbose about what will be done'
+ complete -c killall -s e -d 'Use effective user ID instead of the real user ID for matching processes specified with the -u option'
+ complete -c killall -s help -d 'Print help and exit'
+ complete -c killall -s l -d 'List names of available signals and exit'
+ complete -c killall -s m -d 'Case sensitive argument match for processed'
+ complete -c killall -s s -d 'Simulate, but do not send any signals'
+ complete -c killall -s d -d 'Print detailed info. Doesn\'t send signals'
+ complete -c killall -s u -x -d 'Only processes for USER'
+ # Completions for users
+ __make_users_completions
+ complete -c killall -s t -d 'Limit to processes running on specified TTY'
+ complete -c killall -s t -xa "(ps a -o tty | sed 1d | uniq)"
+ complete -c killall -s c -x -d 'Limit to processes matching specified PROCNAME'
+ complete -c killall -s z -d 'Do not skip zombies'
+ end
+end