share: use "status is-*" instead of old-school "status --is-*"

This commit is contained in:
Johannes Altmanninger
2026-05-07 12:44:31 +08:00
parent e697f960c8
commit 1e0ff8712d
5 changed files with 9 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ function __fish_default_command_not_found_handler
printf (_ "fish: Unknown command: %s\n") (string escape -- $argv[1]) >&2
end
if not status --is-interactive
if not status is-interactive
# Hook up the default as the command_not_found handler
# if we are not interactive to avoid custom handlers.
function fish_command_not_found --on-event fish_command_not_found
@@ -148,7 +148,7 @@ and __fish_set_locale
# Some things should only be done for login terminals
# This used to be in etc/config.fish - keep it here to keep the semantics
#
if status --is-login
if status is-login
if command -sq /usr/libexec/path_helper
__fish_macos_set_env PATH /etc/paths '/etc/paths.d'
if test -n "$MANPATH"

View File

@@ -29,14 +29,14 @@ function __fish_config_interactive -d "Initializations that should be performed
# The default just prints a variable of the same name.
#
# NOTE: This status check is necessary to not print the greeting when `read`ing in scripts. See #7080.
if status --is-interactive
if status is-interactive
and functions -q fish_greeting
fish_greeting
end
# Display SHELL_WELCOME if set. This is a standard environment variable (introduced by
# systemd v257) intended for shells to display when they first initialize.
if status --is-interactive
if status is-interactive
and set -q SHELL_WELCOME[1]
string join -- ' ' $SHELL_WELCOME
end

View File

@@ -14,7 +14,7 @@ function cd --description "Change directory"
end
# Skip history in subshells.
if status --is-command-substitution
if status is-command-substitution
builtin cd $argv
return $status
end

View File

@@ -663,7 +663,7 @@ end
function __fish_git_prompt_reset -a type -a op -a var --description "Event handler, resets prompt when functionality changes" \
--on-variable=__fish_git_prompt_{show_informative_status,use_informative_chars}
if status --is-interactive
if status is-interactive
# Clear characters that have different defaults with/without informative status
set -e ___fish_git_prompt_char_{name,cleanstate,dirtystate,invalidstate,stagedstate,stashstate,stateseparator,untrackedfiles,upstream_ahead,upstream_behind}
# Clear init so we reset the chars next time.
@@ -673,7 +673,7 @@ end
function __fish_git_prompt_reset_color -a type -a op -a var --description "Event handler, resets prompt when any color changes" \
--on-variable=__fish_git_prompt_color{'',_prefix,_suffix,_bare,_merging,_cleanstate,_invalidstate,_upstream,_flags,_branch,_dirtystate,_stagedstate,_branch_detached,_stashstate,_untrackedfiles} --on-variable=__fish_git_prompt_showcolorhints
if status --is-interactive
if status is-interactive
set -e _$var
set -e _{$var}_done
set -e ___fish_git_prompt_init
@@ -686,7 +686,7 @@ end
function __fish_git_prompt_reset_char -a type -a op -a var --description "Event handler, resets prompt when any char changes" \
--on-variable=__fish_git_prompt_char_{cleanstate,dirtystate,invalidstate,stagedstate,stashstate,stateseparator,untrackedfiles,upstream_ahead,upstream_behind,upstream_diverged,upstream_equal,upstream_prefix}
if status --is-interactive
if status is-interactive
set -e ___fish_git_prompt_init
set -e _$var
end

View File

@@ -13,7 +13,7 @@ function psub --description "Read from stdin into a file and output the filename
set -l filename
set -l funcname
if not status --is-command-substitution
if not status is-command-substitution
{
printf (_ "%s: Not inside of command substitution") psub
echo