From 4a8db53bcf59f13d5c5fc9f7cc6c5b52e0d9ba9a Mon Sep 17 00:00:00 2001 From: David Adam Date: Wed, 9 Jan 2019 22:34:43 +0800 Subject: [PATCH] status docs: add current-command Note deprecation of $_. [ci skip] --- doc_src/index.hdr.in | 4 ++-- doc_src/status.txt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in index 7f2fe7efc..6acfa4a22 100644 --- a/doc_src/index.hdr.in +++ b/doc_src/index.hdr.in @@ -677,7 +677,7 @@ set index 2 set letters a b c d echo $letters[$index] # returns 'b' \endfish -However using variables as indices for command substitution is currently not supported, so +However using variables as indices for command substitution is currently not supported, so \fish echo (seq 5)[$index] # This won't work @@ -923,7 +923,7 @@ The user can change the settings of `fish` by changing the values of certain var `fish` also sends additional information to the user through the values of certain environment variables. The user cannot change the values of most of these variables. -- `_`, the name of the currently running command. +- `_`, the name of the currently running command (though this is deprecated, and the use of `status current-command` is preferred). - `argv`, an array of arguments to the shell or function. `argv` is only defined when inside a function call, or if fish was invoked with a list of arguments, like `fish myscript.fish foo bar`. This variable can be changed by the user. diff --git a/doc_src/status.txt b/doc_src/status.txt index b69996d57..c2f99f800 100644 --- a/doc_src/status.txt +++ b/doc_src/status.txt @@ -11,6 +11,7 @@ status is-command-substitution status is-no-job-control status is-full-job-control status is-interactive-job-control +status current-command status filename status fish-path status function @@ -43,6 +44,8 @@ The following operations (sub-commands) are available: - `is-no-job-control` returns 0 if no job control is enabled. Also `--is-no-job-control` (no short flag). +- `current-command` prints the name of the currently-running function or command, like the deprecated `_` variable. + - `filename` prints the filename of the currently running script. Also `current-filename`, `-f` or `--current-filename`. - `fish-path` prints the absolute path to the currently executing instance of fish.