From d44c21b58060b85b2396fbd7a2dee2f156168e47 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 16 Sep 2018 10:39:15 +0200 Subject: [PATCH] Document/complete feature flags more --- doc_src/fish.txt | 2 ++ doc_src/status.txt | 8 +++++++- share/completions/status.fish | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc_src/fish.txt b/doc_src/fish.txt index 10a538109..5e22e526d 100644 --- a/doc_src/fish.txt +++ b/doc_src/fish.txt @@ -29,4 +29,6 @@ The following options are available: - `-D` or `--debug-stack-frames=DEBUG_LEVEL` specify how many stack frames to display when debug messages are written. The default is zero. A value of 3 or 4 is usually sufficient to gain insight into how a given debug call was reached but you can specify a value up to 128. +- `-f` or `--features=FEATURES` enables one or more feature flags (separated by a comma). These are how fish stages changes that might break scripts. + The fish exit status is generally the exit status of the last foreground command. If fish is exiting because of a parse error, the exit status is 127. diff --git a/doc_src/status.txt b/doc_src/status.txt index acf0cac8d..905cfb2f3 100644 --- a/doc_src/status.txt +++ b/doc_src/status.txt @@ -16,6 +16,8 @@ status function status line-number status stack-trace status job-control CONTROL-TYPE +status features +status test-feature FEATURE \endfish \subsection status-description Description @@ -47,9 +49,13 @@ The following operations (sub-commands) are available: - `line-number` prints the line number of the currently running script. Also `current-line-number`, `-n` or `--current-line-number`. +- `stack-trace` prints a stack trace of all function calls on the call stack. Also `print-stack-trace`, `-t` or `--print-stack-trace`. + - `job-control CONTROL-TYPE` sets the job control type, which can be `none`, `full`, or `interactive`. Also `-j CONTROL-TYPE` or `--job-control=CONTROL-TYPE`. -- `stack-trace` prints a stack trace of all function calls on the call stack. Also `print-stack-trace`, `-t` or `--print-stack-trace`. +- `features` lists all available feature flags. + +- `test-feature FEATURE` returns 0 when FEATURE is enabled, 1 if it is disabled, and 2 if it is not recognized. \subsection status-notes Notes diff --git a/share/completions/status.fish b/share/completions/status.fish index fc680dde8..1a392614c 100644 --- a/share/completions/status.fish +++ b/share/completions/status.fish @@ -1,5 +1,5 @@ # Note that when a completion file is sourced a new block scope is created so `set -l` works. -set -l __fish_status_all_commands is-login is-interactive is-block is-breakpoint is-command-substitution is-no-job-control is-interactive-job-control is-full-job-control current-filename current-line-number print-stack-trace job-control +set -l __fish_status_all_commands is-login is-interactive is-block is-breakpoint is-command-substitution is-no-job-control is-interactive-job-control is-full-job-control current-filename current-line-number print-stack-trace job-control features test-feature # These are the recognized flags. complete -c status -s h -l help -d "Display help and exit" @@ -24,3 +24,7 @@ complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_com complete -f -c status -n "__fish_seen_subcommand_from job-control" -a full -d "Set all jobs under job control" complete -f -c status -n "__fish_seen_subcommand_from job-control" -a interactive -d "Set only interactive jobs under job control" complete -f -c status -n "__fish_seen_subcommand_from job-control" -a none -d "Set no jobs under job control" + +complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a features -d "List all feature flags" +complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a test-feature -d "Test if a feature flag is enabled" +complete -f -c status -n "__fish_seen_subcommand_from test-feature" -a '(status features)'