fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a53db7256
master
1# localization: skip(private) 2function __fish_make_completion_signals --description'Make list of kill signals for completion' 3set -q __kill_signals 4and return 0 5 6set -g __kill_signals 7 8# Cygwin's kill is special, and the documentation lies. 9# Just hardcode the signals. 10set -l os( uname ) 11if string match -q'CYGWIN*' --$os 12or string match -eiq Msys --$os 13or string match -eiq mingw --$os 14set -a __kill_signals"1 HUP" "2 INT" "3 QUIT" "4 ILL" "5 TRAP" "6 ABRT" \ 15"6 IOT" "7 BUS" "8 FPE" "9 KILL" "10 USR1" "11 SEGV" \ 16"12 USR2" "13 PIPE" "14 ALRM" "15 TERM" "16 STKFLT" "17 CHLD" \ 17"17 CLD" "18 CONT" "19 STOP" "20 TSTP" "21 TTIN" "22 TTOU" \ 18"23 URG" "24 XCPU" "25 XFSZ" "26 VTALRM" "27 PROF" "28 WINC" \ 19"29 IO" "29 POLL" "30 PWR" "31 SYS" "34 RTMIN" "64 RTMA" 20return 21end 22 23# If we don't have a kill, we don't try to run it. 24# We require a kill *command* because we used to unconditionally define 25# a wrapper (to allow %foo expansion) 26command -q kill 27or return 28 29# Some systems use the GNU coreutils kill command where `kill -L` produces an extended table 30# format that looks like this: 31# 32# 1 HUP Hangup: 1 33# 2 INT Interrupt: 2 34# 35# The procps `kill -L` produces a more compact table. We can distinguish the two cases by 36# testing whether it supports `kill -t`; in which case it is the coreutils `kill` command. 37# Darwin doesn't have kill -t or kill -L 38if kill -t2> /dev/null> /dev/null 39or not kill -L2> /dev/null> /dev/null 40# Posix systems print out the name of a signal using 'kill -l SIGNUM'. 41complete -c kill -s l --description"List names of available signals" 42for iin ( seq 31 ) 43set -a __kill_signals$i " " ( kill -l$i 2> /dev/null| string upper) 44end 45else 46# util-linux (on Arch) and procps-ng (on Debian) kill use 'kill -L' to write out a numbered list 47# of signals. Use this to complete on both number _and_ on signal name. 48complete -c kill -s L --description"List codes and names of available signals" 49kill -L2> /dev/null| string trim| string replace -ra' *' \n | while read -l signo signame 50set -a __kill_signals" $signo $signame " 51end 52end 53end