mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 22:17:52 +08:00
18940ea086
* Remove dunderscores from __fish_status_to_signal * Document fish_status_to_signal * CHANGELOG: Add fish_status_to_signal * Add string join to fish_status_to_signal documentation example
21 lines
760 B
Fish
21 lines
760 B
Fish
function fish_status_to_signal --description "Print signal name from argument (\$status), or just argument"
|
|
for arg in $argv
|
|
if test $arg -gt 128
|
|
set -l signals SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS \
|
|
SIGFPE SIGKILL SIGUSR1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM \
|
|
SIGTERM SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP \
|
|
SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM \
|
|
SIGPROF SIGWINCH SIGIO SIGPWR SIGSYS
|
|
set -l sigix (math $arg - 128)
|
|
if test $sigix -le (count $signals)
|
|
echo $signals[$sigix]
|
|
else
|
|
echo $arg
|
|
end
|
|
else
|
|
echo $arg
|
|
end
|
|
end
|
|
return 0
|
|
end
|