mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 14:43:55 +08:00
Keep "; and" and "; or" on fish files
This reformats *.fish files from before commit
c2970f9618
with the changes to fish_indent.
[ci skip]
This commit is contained in:
parent
46b804cf19
commit
bcce6d691f
|
@ -8,8 +8,7 @@ function __fish_describe_command -d "Command used to find descriptions for comma
|
|||
# TODO: stop interpolating argv into regex, and remove this hack.
|
||||
string match --quiet --regex '^[a-zA-Z0-9_ ]+$' -- "$argv"
|
||||
or return
|
||||
type -q apropos
|
||||
or return
|
||||
type -q apropos; or return
|
||||
apropos $argv 2>/dev/null | awk -v FS=" +- +" '{
|
||||
split($1, names, ", ");
|
||||
for (name in names)
|
||||
|
|
|
@ -73,23 +73,18 @@ function __fish_print_help --description "Print help message for the specified f
|
|||
# Remove man's bolding
|
||||
set -l name (string replace -ra '(.)'\b'.' '$1' -- $line)
|
||||
# We start after we have the name
|
||||
contains -- $name NAME
|
||||
and set have_name 1
|
||||
and continue
|
||||
contains -- $name NAME; and set have_name 1; and continue
|
||||
# We ignore the SYNOPSIS header
|
||||
contains -- $name SYNOPSIS
|
||||
and continue
|
||||
contains -- $name SYNOPSIS; and continue
|
||||
# Everything after COPYRIGHT is useless
|
||||
contains -- $name COPYRIGHT
|
||||
and break
|
||||
contains -- $name COPYRIGHT; and break
|
||||
|
||||
# not leading space, and not empty, so must contain a non-space
|
||||
# in the first column. That makes it a header/footer.
|
||||
set line_type meta
|
||||
end
|
||||
|
||||
set -q have_name[1]
|
||||
or continue
|
||||
set -q have_name[1]; or continue
|
||||
switch $state
|
||||
case normal
|
||||
switch $line_type
|
||||
|
|
|
@ -3,7 +3,6 @@ function __fish_print_packages
|
|||
argparse --name=__fish_print_packages 'i/installed' -- $argv
|
||||
or return
|
||||
|
||||
|
||||
set -l only_installed 1
|
||||
if not set -q _flag_installed
|
||||
set -e only_installed
|
||||
|
|
|
@ -33,30 +33,23 @@ function _fish_systemctl --description 'Call systemctl with some options from th
|
|||
help reset-failed list-dependencies list-units revert add-{wants,requires} edit
|
||||
case enable
|
||||
# This will only work for "list-unit-files", but won't print an error for "list-units".
|
||||
set -q _flag_state
|
||||
or set _flag_state disabled
|
||||
set -q _flag_state; or set _flag_state disabled
|
||||
case disable
|
||||
set -q _flag_state
|
||||
or set _flag_state enabled
|
||||
set -q _flag_state; or set _flag_state enabled
|
||||
case start
|
||||
# Running `start` on an already started unit isn't an _error_, but useless.
|
||||
set -q _flag_state
|
||||
or set _flag_state dead,failed
|
||||
set -q _flag_state; or set _flag_state dead,failed
|
||||
case mask
|
||||
set -q _flag_state
|
||||
or set _flag_state loaded
|
||||
set -q _flag_state; or set _flag_state loaded
|
||||
case unmask
|
||||
set -q _flag_state
|
||||
or set _flag_state masked
|
||||
set -q _flag_state; or set _flag_state masked
|
||||
case stop kill
|
||||
# TODO: Is "kill" useful on other unit types?
|
||||
# Running as the catch-all, "mounted" for .mount units, "active" for .target.
|
||||
set -q _flag_state
|
||||
or set _flag_state running,mounted,active
|
||||
set -q _flag_state; or set _flag_state running,mounted,active
|
||||
case isolate set-default
|
||||
# These only take one unit.
|
||||
set -q argv[1]
|
||||
and return
|
||||
set -q argv[1]; and return
|
||||
case list-sockets
|
||||
set _flag_type socket
|
||||
case list-timers
|
||||
|
@ -72,16 +65,11 @@ function _fish_systemctl --description 'Call systemctl with some options from th
|
|||
end
|
||||
|
||||
# Add the flags back so we can pass them to our systemctl invocations.
|
||||
set -q _flag_type
|
||||
and set passflags $passflags --type=$_flag_type
|
||||
set -q _flag_state
|
||||
and set passflags $passflags --state=$_flag_state
|
||||
set -q _flag_property
|
||||
and set passflags $passflags --property=$_flag_property
|
||||
set -q _flag_machine
|
||||
and set passflags $passflags --machine=$_flag_machine
|
||||
set -q _flag_host
|
||||
and set passflags $passflags --host=$_flag_host
|
||||
set -q _flag_type; and set passflags $passflags --type=$_flag_type
|
||||
set -q _flag_state; and set passflags $passflags --state=$_flag_state
|
||||
set -q _flag_property; and set passflags $passflags --property=$_flag_property
|
||||
set -q _flag_machine; and set passflags $passflags --machine=$_flag_machine
|
||||
set -q _flag_host; and set passflags $passflags --host=$_flag_host
|
||||
|
||||
# Output looks like
|
||||
# systemd-tmpfiles-clean.timer [more whitespace] loaded active waiting Daily Cleanup[...]
|
||||
|
|
|
@ -53,14 +53,12 @@ function abbr --description "Manage abbreviations"
|
|||
else if set -q _flag_query[1]
|
||||
# "--query": Check if abbrs exist.
|
||||
# If we don't have an argument, it's an automatic failure.
|
||||
set -q argv[1]
|
||||
or return 1
|
||||
set -q argv[1]; or return 1
|
||||
set -l escaped _fish_abbr_(string escape --style=var -- $argv)
|
||||
# We return 0 if any arg exists, whereas `set -q` returns the number of undefined arguments.
|
||||
# But we should be consistent with `type -q` and `command -q`.
|
||||
for var in $escaped
|
||||
set -q $escaped
|
||||
and return 0
|
||||
set -q $escaped; and return 0
|
||||
end
|
||||
return 1
|
||||
else
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
function fish_clipboard_copy
|
||||
# Copy the current selection, or the entire commandline if that is empty.
|
||||
set -l cmdline (commandline --current-selection)
|
||||
test -n "$cmdline"
|
||||
or set cmdline (commandline)
|
||||
test -n "$cmdline"; or set cmdline (commandline)
|
||||
if type -q pbcopy
|
||||
printf '%s\n' $cmdline | pbcopy
|
||||
else if type -q xsel
|
||||
|
|
|
@ -454,8 +454,7 @@ function fish_git_prompt --description "Prompt function for Git"
|
|||
set b (string replace refs/heads/ '' -- $b)
|
||||
set -q __fish_git_prompt_shorten_branch_char_suffix
|
||||
or set -l __fish_git_prompt_shorten_branch_char_suffix "…"
|
||||
if string match -qr '^\d+$' "$__fish_git_prompt_shorten_branch_len"
|
||||
and test (string length "$b") -gt $__fish_git_prompt_shorten_branch_len
|
||||
if string match -qr '^\d+$' "$__fish_git_prompt_shorten_branch_len"; and test (string length "$b") -gt $__fish_git_prompt_shorten_branch_len
|
||||
set b (string sub -l "$__fish_git_prompt_shorten_branch_len" "$b")"$__fish_git_prompt_shorten_branch_char_suffix"
|
||||
end
|
||||
if test -n "$b"
|
||||
|
@ -549,8 +548,7 @@ function __fish_git_prompt_informative_status
|
|||
set -l untrackedfiles (command git ls-files --others --exclude-standard | count)
|
||||
set -l stashstate 0
|
||||
set -l stashfile "$argv[1]/logs/refs/stash"
|
||||
if set -q __fish_git_prompt_showstashstate
|
||||
and test -e "$stashfile"
|
||||
if set -q __fish_git_prompt_showstashstate; and test -e "$stashfile"
|
||||
set stashstate (count < $stashfile)
|
||||
end
|
||||
|
||||
|
|
|
@ -69,8 +69,7 @@ function help --description 'Show help for the fish shell'
|
|||
set fish_browser cygstart
|
||||
# If xdg-open is available, just use that
|
||||
# but only if an X session is running
|
||||
else if type -q xdg-open
|
||||
and set -q -x DISPLAY
|
||||
else if type -q xdg-open; and set -q -x DISPLAY
|
||||
set fish_browser xdg-open
|
||||
end
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ function type --description 'Print the type of a command'
|
|||
case "n/a"
|
||||
case "stdin"
|
||||
break
|
||||
|
||||
case "*"
|
||||
echo $func_path
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user