From 18940ea086ebff326e9e76a53430cabe7f9a69b7 Mon Sep 17 00:00:00 2001 From: Ilan Cosman Date: Sun, 3 Jan 2021 06:15:57 -0800 Subject: [PATCH] Remove dunderscores from __fish_status_to_signal (#7597) * 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 --- CHANGELOG.rst | 1 + doc_src/cmds/fish_status_to_signal.rst | 29 +++++++++++++++++++ share/functions/__fish_print_pipestatus.fish | 2 +- ...signal.fish => fish_status_to_signal.fish} | 2 +- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 doc_src/cmds/fish_status_to_signal.rst rename share/functions/{__fish_status_to_signal.fish => fish_status_to_signal.fish} (85%) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 68ddea838..b02854286 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -102,6 +102,7 @@ Scripting improvements - ``string`` subcommands now quit early when used with ``--quiet`` (:issue:`7495`). - Failed redirections will now set ``$status`` (:issue:`7540`). - ``read`` can now read interactively from other files, so e.g. forcing it to read from the terminal via ``read _ sleep 5 + ^C⏎ + >_ fish_status_to_signal $status + SIGINT \ No newline at end of file diff --git a/share/functions/__fish_print_pipestatus.fish b/share/functions/__fish_print_pipestatus.fish index 22f75def4..aad28909a 100644 --- a/share/functions/__fish_print_pipestatus.fish +++ b/share/functions/__fish_print_pipestatus.fish @@ -23,7 +23,7 @@ function __fish_print_pipestatus --description "Print pipestatus for prompt" # SIGPIPE (141 = 128 + 13) is usually not a failure, see #6375. if not contains $last_status 0 141 set -l sep $brace_sep_color$separator$status_color - set -l last_pipestatus_string (__fish_status_to_signal $argv | string join "$sep") + set -l last_pipestatus_string (fish_status_to_signal $argv | string join "$sep") set -l last_status_string "" if test $last_status -ne $argv[-1] set last_status_string " "$status_color$last_status diff --git a/share/functions/__fish_status_to_signal.fish b/share/functions/fish_status_to_signal.fish similarity index 85% rename from share/functions/__fish_status_to_signal.fish rename to share/functions/fish_status_to_signal.fish index 47fa38ff5..2d09916dc 100644 --- a/share/functions/__fish_status_to_signal.fish +++ b/share/functions/fish_status_to_signal.fish @@ -1,4 +1,4 @@ -function __fish_status_to_signal --description "Print signal name from argument (\$status), or just argument" +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 \