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:
Fabian Homborg 2019-05-05 13:33:35 +02:00
parent 46b804cf19
commit bcce6d691f
9 changed files with 23 additions and 49 deletions

View file

@ -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. # TODO: stop interpolating argv into regex, and remove this hack.
string match --quiet --regex '^[a-zA-Z0-9_ ]+$' -- "$argv" string match --quiet --regex '^[a-zA-Z0-9_ ]+$' -- "$argv"
or return or return
type -q apropos type -q apropos; or return
or return
apropos $argv 2>/dev/null | awk -v FS=" +- +" '{ apropos $argv 2>/dev/null | awk -v FS=" +- +" '{
split($1, names, ", "); split($1, names, ", ");
for (name in names) for (name in names)

View file

@ -73,23 +73,18 @@ function __fish_print_help --description "Print help message for the specified f
# Remove man's bolding # Remove man's bolding
set -l name (string replace -ra '(.)'\b'.' '$1' -- $line) set -l name (string replace -ra '(.)'\b'.' '$1' -- $line)
# We start after we have the name # We start after we have the name
contains -- $name NAME contains -- $name NAME; and set have_name 1; and continue
and set have_name 1
and continue
# We ignore the SYNOPSIS header # We ignore the SYNOPSIS header
contains -- $name SYNOPSIS contains -- $name SYNOPSIS; and continue
and continue
# Everything after COPYRIGHT is useless # Everything after COPYRIGHT is useless
contains -- $name COPYRIGHT contains -- $name COPYRIGHT; and break
and break
# not leading space, and not empty, so must contain a non-space # not leading space, and not empty, so must contain a non-space
# in the first column. That makes it a header/footer. # in the first column. That makes it a header/footer.
set line_type meta set line_type meta
end end
set -q have_name[1] set -q have_name[1]; or continue
or continue
switch $state switch $state
case normal case normal
switch $line_type switch $line_type

View file

@ -3,7 +3,6 @@ function __fish_print_packages
argparse --name=__fish_print_packages 'i/installed' -- $argv argparse --name=__fish_print_packages 'i/installed' -- $argv
or return or return
set -l only_installed 1 set -l only_installed 1
if not set -q _flag_installed if not set -q _flag_installed
set -e only_installed set -e only_installed

View file

@ -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 help reset-failed list-dependencies list-units revert add-{wants,requires} edit
case enable case enable
# This will only work for "list-unit-files", but won't print an error for "list-units". # This will only work for "list-unit-files", but won't print an error for "list-units".
set -q _flag_state set -q _flag_state; or set _flag_state disabled
or set _flag_state disabled
case disable case disable
set -q _flag_state set -q _flag_state; or set _flag_state enabled
or set _flag_state enabled
case start case start
# Running `start` on an already started unit isn't an _error_, but useless. # Running `start` on an already started unit isn't an _error_, but useless.
set -q _flag_state set -q _flag_state; or set _flag_state dead,failed
or set _flag_state dead,failed
case mask case mask
set -q _flag_state set -q _flag_state; or set _flag_state loaded
or set _flag_state loaded
case unmask case unmask
set -q _flag_state set -q _flag_state; or set _flag_state masked
or set _flag_state masked
case stop kill case stop kill
# TODO: Is "kill" useful on other unit types? # TODO: Is "kill" useful on other unit types?
# Running as the catch-all, "mounted" for .mount units, "active" for .target. # Running as the catch-all, "mounted" for .mount units, "active" for .target.
set -q _flag_state set -q _flag_state; or set _flag_state running,mounted,active
or set _flag_state running,mounted,active
case isolate set-default case isolate set-default
# These only take one unit. # These only take one unit.
set -q argv[1] set -q argv[1]; and return
and return
case list-sockets case list-sockets
set _flag_type socket set _flag_type socket
case list-timers case list-timers
@ -72,16 +65,11 @@ function _fish_systemctl --description 'Call systemctl with some options from th
end end
# Add the flags back so we can pass them to our systemctl invocations. # Add the flags back so we can pass them to our systemctl invocations.
set -q _flag_type set -q _flag_type; and set passflags $passflags --type=$_flag_type
and set passflags $passflags --type=$_flag_type set -q _flag_state; and set passflags $passflags --state=$_flag_state
set -q _flag_state set -q _flag_property; and set passflags $passflags --property=$_flag_property
and set passflags $passflags --state=$_flag_state set -q _flag_machine; and set passflags $passflags --machine=$_flag_machine
set -q _flag_property set -q _flag_host; and set passflags $passflags --host=$_flag_host
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 # Output looks like
# systemd-tmpfiles-clean.timer [more whitespace] loaded active waiting Daily Cleanup[...] # systemd-tmpfiles-clean.timer [more whitespace] loaded active waiting Daily Cleanup[...]

View file

@ -53,14 +53,12 @@ function abbr --description "Manage abbreviations"
else if set -q _flag_query[1] else if set -q _flag_query[1]
# "--query": Check if abbrs exist. # "--query": Check if abbrs exist.
# If we don't have an argument, it's an automatic failure. # If we don't have an argument, it's an automatic failure.
set -q argv[1] set -q argv[1]; or return 1
or return 1
set -l escaped _fish_abbr_(string escape --style=var -- $argv) 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. # 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`. # But we should be consistent with `type -q` and `command -q`.
for var in $escaped for var in $escaped
set -q $escaped set -q $escaped; and return 0
and return 0
end end
return 1 return 1
else else

View file

@ -1,8 +1,7 @@
function fish_clipboard_copy function fish_clipboard_copy
# Copy the current selection, or the entire commandline if that is empty. # Copy the current selection, or the entire commandline if that is empty.
set -l cmdline (commandline --current-selection) set -l cmdline (commandline --current-selection)
test -n "$cmdline" test -n "$cmdline"; or set cmdline (commandline)
or set cmdline (commandline)
if type -q pbcopy if type -q pbcopy
printf '%s\n' $cmdline | pbcopy printf '%s\n' $cmdline | pbcopy
else if type -q xsel else if type -q xsel

View file

@ -454,8 +454,7 @@ function fish_git_prompt --description "Prompt function for Git"
set b (string replace refs/heads/ '' -- $b) set b (string replace refs/heads/ '' -- $b)
set -q __fish_git_prompt_shorten_branch_char_suffix set -q __fish_git_prompt_shorten_branch_char_suffix
or set -l __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" if string match -qr '^\d+$' "$__fish_git_prompt_shorten_branch_len"; and test (string length "$b") -gt $__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" set b (string sub -l "$__fish_git_prompt_shorten_branch_len" "$b")"$__fish_git_prompt_shorten_branch_char_suffix"
end end
if test -n "$b" 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 untrackedfiles (command git ls-files --others --exclude-standard | count)
set -l stashstate 0 set -l stashstate 0
set -l stashfile "$argv[1]/logs/refs/stash" set -l stashfile "$argv[1]/logs/refs/stash"
if set -q __fish_git_prompt_showstashstate if set -q __fish_git_prompt_showstashstate; and test -e "$stashfile"
and test -e "$stashfile"
set stashstate (count < $stashfile) set stashstate (count < $stashfile)
end end

View file

@ -69,8 +69,7 @@ function help --description 'Show help for the fish shell'
set fish_browser cygstart set fish_browser cygstart
# If xdg-open is available, just use that # If xdg-open is available, just use that
# but only if an X session is running # but only if an X session is running
else if type -q xdg-open else if type -q xdg-open; and set -q -x DISPLAY
and set -q -x DISPLAY
set fish_browser xdg-open set fish_browser xdg-open
end end

View file

@ -62,7 +62,6 @@ function type --description 'Print the type of a command'
case "n/a" case "n/a"
case "stdin" case "stdin"
break break
case "*" case "*"
echo $func_path echo $func_path
end end