mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
reformat all fish scripts
I hate doing this but I am tired of touching a fish script as part of some change and having `make style` radically change it. Which makes editing fish scripts more painful than it needs to be. It is time to do a wholesale reformatting of these scripts to conform to the documented style as implemented by the `fish_indent` program.
This commit is contained in:
parent
54a76bb9e5
commit
11a60c8374
161 changed files with 2638 additions and 2587 deletions
|
@ -1,14 +1,14 @@
|
||||||
|
|
||||||
function __fish_bind_test2
|
function __fish_bind_test2
|
||||||
set -l args
|
set -l args
|
||||||
for i in (commandline -poc)
|
for i in (commandline -poc)
|
||||||
switch $i
|
switch $i
|
||||||
case "-*"
|
case "-*"
|
||||||
|
|
||||||
case "*"
|
case "*"
|
||||||
set args $args $i
|
set args $args $i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
switch (count $args)
|
switch (count $args)
|
||||||
case 2
|
case 2
|
||||||
|
|
|
@ -8,7 +8,8 @@ function __fish_complete_ant_targets -d "Print list of targets from build.xml an
|
||||||
set files (sed -n "s/^.*<import[^>]* file=[\"']\([^\"']*\)[\"'].*\$/\1/p" < $buildfile)
|
set files (sed -n "s/^.*<import[^>]* file=[\"']\([^\"']*\)[\"'].*\$/\1/p" < $buildfile)
|
||||||
|
|
||||||
# iterate through files and display their targets
|
# iterate through files and display their targets
|
||||||
for file in $files;
|
for file in $files
|
||||||
|
|
||||||
__fish_filter_ant_targets $file
|
__fish_filter_ant_targets $file
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,11 +4,13 @@ function __fish_complete_cd -d "Completions for the cd command"
|
||||||
if string match -qr '^\.?\.?/.*' -- $token
|
if string match -qr '^\.?\.?/.*' -- $token
|
||||||
for d in $token*/
|
for d in $token*/
|
||||||
# Check if it's accessible - the glob only matches directories
|
# Check if it's accessible - the glob only matches directories
|
||||||
[ -x $d ]; and printf "%s\n" $d
|
[ -x $d ]
|
||||||
|
and printf "%s\n" $d
|
||||||
end
|
end
|
||||||
else # Relative path - check $CDPATH and use that as description
|
else # Relative path - check $CDPATH and use that as description
|
||||||
set -l cdpath $CDPATH
|
set -l cdpath $CDPATH
|
||||||
[ -z "$cdpath" ]; and set cdpath "."
|
[ -z "$cdpath" ]
|
||||||
|
and set cdpath "."
|
||||||
# Remove the real path to "." (i.e. $PWD) from cdpath if we're in it
|
# Remove the real path to "." (i.e. $PWD) from cdpath if we're in it
|
||||||
# so it doesn't get printed in the descriptions
|
# so it doesn't get printed in the descriptions
|
||||||
if set -l ind (contains -i -- $PWD $cdpath)
|
if set -l ind (contains -i -- $PWD $cdpath)
|
||||||
|
@ -21,11 +23,13 @@ function __fish_complete_cd -d "Completions for the cd command"
|
||||||
set -l desc
|
set -l desc
|
||||||
# Don't show description for current directory
|
# Don't show description for current directory
|
||||||
# and replace $HOME with "~"
|
# and replace $HOME with "~"
|
||||||
[ $i = "." ]; or set -l desc (string replace -r -- "^$HOME" "~" "$i")
|
[ $i = "." ]
|
||||||
|
or set -l desc (string replace -r -- "^$HOME" "~" "$i")
|
||||||
# This assumes the CDPATH component itself is cd-able
|
# This assumes the CDPATH component itself is cd-able
|
||||||
for d in $i/$token*/
|
for d in $i/$token*/
|
||||||
# Remove the cdpath component again
|
# Remove the cdpath component again
|
||||||
[ -x $d ]; and printf "%s\t%s\n" (string replace -r "^$i/" "" -- $d) $desc
|
[ -x $d ]
|
||||||
|
and printf "%s\t%s\n" (string replace -r "^$i/" "" -- $d) $desc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ where:
|
||||||
separator - a symbol, separating individual entries
|
separator - a symbol, separating individual entries
|
||||||
function - a function which prints a completion list to complete each entry
|
function - a function which prints a completion list to complete each entry
|
||||||
prefix - a prefix, which is printed before the list
|
prefix - a prefix, which is printed before the list
|
||||||
itemprefix - a prefix, which is printed before each item" > /dev/stderr
|
itemprefix - a prefix, which is printed before each item" >/dev/stderr
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
set -q iprefix[1]
|
set -q iprefix[1]
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function __fish_complete_lsusb
|
function __fish_complete_lsusb
|
||||||
lsusb | awk '{print $2 ":" $4}'| cut -c1-7
|
lsusb | awk '{print $2 ":" $4}' | cut -c1-7
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
function __fish_complete_svn_diff --description 'Complete "svn diff" arguments'
|
function __fish_complete_svn_diff --description 'Complete "svn diff" arguments'
|
||||||
set -l cmdl (commandline -cop)
|
set -l cmdl (commandline -cop)
|
||||||
#set -l cmdl svn diff --diff-cmd diff --extensions '-a -b'
|
#set -l cmdl svn diff --diff-cmd diff --extensions '-a -b'
|
||||||
set -l diff diff
|
set -l diff diff
|
||||||
set -l args
|
set -l args
|
||||||
while set -q cmdl[1]
|
while set -q cmdl[1]
|
||||||
switch $cmdl[1]
|
switch $cmdl[1]
|
||||||
case --diff-cmd
|
case --diff-cmd
|
||||||
if set -q cmdl[2]
|
if set -q cmdl[2]
|
||||||
set diff $cmdl[2]
|
set diff $cmdl[2]
|
||||||
set -e cmd[2]
|
set -e cmd[2]
|
||||||
end
|
end
|
||||||
|
|
||||||
case --extensions
|
case --extensions
|
||||||
if set -q cmdl[2]
|
if set -q cmdl[2]
|
||||||
set args $cmdl[2]
|
set args $cmdl[2]
|
||||||
set -e cmdl[2]
|
set -e cmdl[2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
set -e cmdl[1]
|
set -e cmdl[1]
|
||||||
end
|
end
|
||||||
set -l token (commandline -cpt)
|
set -l token (commandline -cpt)
|
||||||
complete -C"$diff $args $token"
|
complete -C"$diff $args $token"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,6 @@ function __fish_complete_users --description "Print a list of local users, with
|
||||||
else if test -x /usr/bin/dscl
|
else if test -x /usr/bin/dscl
|
||||||
dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
||||||
else
|
else
|
||||||
string match -v -r '^\s*#' < /etc/passwd | cut -d : -f 1,5 | string replace ':' \t
|
string match -v -r '^\s*#' </etc/passwd | cut -d : -f 1,5 | string replace ':' \t
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --ar
|
||||||
|
|
||||||
for file in $cfgfiles
|
for file in $cfgfiles
|
||||||
if test -f $file
|
if test -f $file
|
||||||
string match -r '\[Dialer' < $file | string replace -r '\[Dialer (.+)\]' '$1'
|
string match -r '\[Dialer' <$file | string replace -r '\[Dialer (.+)\]' '$1'
|
||||||
end
|
end
|
||||||
end | sort -u | string match -v Defaults
|
end | sort -u | string match -v Defaults
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,8 @@ function __fish_config_interactive -d "Initializations that should be performed
|
||||||
# Suppress duplicative title display on Terminal.app
|
# Suppress duplicative title display on Terminal.app
|
||||||
if not functions -q fish_title
|
if not functions -q fish_title
|
||||||
echo -n \e\]0\;\a # clear existing title
|
echo -n \e\]0\;\a # clear existing title
|
||||||
function fish_title -d 'no-op terminal title'; end
|
function fish_title -d 'no-op terminal title'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
|
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# a function to obtain a list of installed packages with CRUX pkgutils
|
# a function to obtain a list of installed packages with CRUX pkgutils
|
||||||
function __fish_crux_packages -d 'Obtain a list of installed packages'
|
function __fish_crux_packages -d 'Obtain a list of installed packages'
|
||||||
pkginfo -i|cut -d' ' -f1
|
pkginfo -i | cut -d' ' -f1
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function __fish_filter_ant_targets -d "Display targets within an ant build.xml file"
|
function __fish_filter_ant_targets -d "Display targets within an ant build.xml file"
|
||||||
sed -n "s/^.*<target[^>]* name=[\"']\([^\"']*\)[\"'].*\$/\1/p" < $argv[1]
|
sed -n "s/^.*<target[^>]* name=[\"']\([^\"']*\)[\"'].*\$/\1/p" <$argv[1]
|
||||||
end
|
end
|
||||||
|
|
|
@ -484,7 +484,8 @@ function __fish_git_prompt_informative_status
|
||||||
|
|
||||||
# If `math` fails for some reason, assume the state is clean - it's the simpler path
|
# If `math` fails for some reason, assume the state is clean - it's the simpler path
|
||||||
set -l state (math $dirtystate + $invalidstate + $stagedstate + $untrackedfiles ^/dev/null)
|
set -l state (math $dirtystate + $invalidstate + $stagedstate + $untrackedfiles ^/dev/null)
|
||||||
if test -z "$state"; or test "$state" = 0
|
if test -z "$state"
|
||||||
|
or test "$state" = 0
|
||||||
set info $___fish_git_prompt_color_cleanstate$___fish_git_prompt_char_cleanstate$___fish_git_prompt_color_cleanstate_done
|
set info $___fish_git_prompt_color_cleanstate$___fish_git_prompt_char_cleanstate$___fish_git_prompt_color_cleanstate_done
|
||||||
else
|
else
|
||||||
for i in $___fish_git_prompt_status_order
|
for i in $___fish_git_prompt_status_order
|
||||||
|
|
|
@ -23,7 +23,7 @@ set -g fish_prompt_hg_status_order added modified copied deleted untracked unmer
|
||||||
function __fish_hg_prompt --description 'Write out the hg prompt'
|
function __fish_hg_prompt --description 'Write out the hg prompt'
|
||||||
# If hg isn't installed, there's nothing we can do
|
# If hg isn't installed, there's nothing we can do
|
||||||
# Return 1 so the calling prompt can deal with it
|
# Return 1 so the calling prompt can deal with it
|
||||||
if not command -s hg > /dev/null
|
if not command -s hg >/dev/null
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,12 +69,18 @@ function __fish_hg_prompt --description 'Write out the hg prompt'
|
||||||
|
|
||||||
# Add a character for each file status if we have one
|
# Add a character for each file status if we have one
|
||||||
switch $line
|
switch $line
|
||||||
case 'A ' ; set hg_statuses $hg_statuses added
|
case 'A '
|
||||||
case 'M ' ' M' ; set hg_statuses $hg_statuses modified
|
set hg_statuses $hg_statuses added
|
||||||
case 'C ' ; set hg_statuses $hg_statuses copied
|
case 'M ' ' M'
|
||||||
case 'D ' ' D' ; set hg_statuses $hg_statuses deleted
|
set hg_statuses $hg_statuses modified
|
||||||
case '\? ' ; set hg_statuses $hg_statuses untracked
|
case 'C '
|
||||||
case 'U*' '*U' 'DD' 'AA'; set hg_statuses $hg_statuses unmerged
|
set hg_statuses $hg_statuses copied
|
||||||
|
case 'D ' ' D'
|
||||||
|
set hg_statuses $hg_statuses deleted
|
||||||
|
case '\? '
|
||||||
|
set hg_statuses $hg_statuses untracked
|
||||||
|
case 'U*' '*U' 'DD' 'AA'
|
||||||
|
set hg_statuses $hg_statuses unmerged
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ function __fish_is_first_token -d 'Test if no non-switch argument has been speci
|
||||||
case '-*'
|
case '-*'
|
||||||
|
|
||||||
case '*'
|
case '*'
|
||||||
return 1;
|
return 1
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -11,7 +11,8 @@ function __fish_make_completion_signals --description 'Make list of kill signals
|
||||||
# The procps `kill -L` produces a more compact table. We can distinguish the two cases by
|
# The procps `kill -L` produces a more compact table. We can distinguish the two cases by
|
||||||
# testing whether it supports `kill -t`; in which case it is the coreutils `kill` command.
|
# testing whether it supports `kill -t`; in which case it is the coreutils `kill` command.
|
||||||
# Darwin doesn't have kill -t or kill -L
|
# Darwin doesn't have kill -t or kill -L
|
||||||
if kill -t ^/dev/null >/dev/null; or not kill -L ^/dev/null >/dev/null
|
if kill -t ^/dev/null >/dev/null
|
||||||
|
or not kill -L ^/dev/null >/dev/null
|
||||||
# Posix systems print out the name of a signal using 'kill -l SIGNUM'.
|
# Posix systems print out the name of a signal using 'kill -l SIGNUM'.
|
||||||
complete -c kill -s l --description "List names of available signals"
|
complete -c kill -s l --description "List names of available signals"
|
||||||
for i in (seq 31)
|
for i in (seq 31)
|
||||||
|
|
|
@ -5,7 +5,7 @@ function __fish_paginate -d "Paginate the current command using the users defaul
|
||||||
set cmd $PAGER
|
set cmd $PAGER
|
||||||
end
|
end
|
||||||
|
|
||||||
if commandline -j| string match -q -r -v "$cmd *\$"
|
if commandline -j | string match -q -r -v "$cmd *\$"
|
||||||
|
|
||||||
commandline -aj " ^&1 |$cmd;"
|
commandline -aj " ^&1 |$cmd;"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function __fish_print_encodings -d "Complete using available character encodings"
|
function __fish_print_encodings -d "Complete using available character encodings"
|
||||||
iconv --list|sed -e 's|//||'
|
iconv --list | sed -e 's|//||'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
function __fish_print_function_prototypes -d "Prints the names of all function prototypes found in the headers in the current directory"
|
function __fish_print_function_prototypes -d "Prints the names of all function prototypes found in the headers in the current directory"
|
||||||
cat *.h*|sed -n "s/^\(.*[^[a-zA-Z_0-9]\|\)\([a-zA-Z_][a-zA-Z_0-9]*\) *(.*);.*\$/\2/p"
|
cat *.h* | sed -n "s/^\(.*[^[a-zA-Z_0-9]\|\)\([a-zA-Z_][a-zA-Z_0-9]*\) *(.*);.*\$/\2/p"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,38 +4,36 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
|
||||||
|
|
||||||
# Print all hosts from /etc/hosts
|
# Print all hosts from /etc/hosts
|
||||||
# use 'getent hosts' on OSes that support it (OpenBSD and Cygwin do not)
|
# use 'getent hosts' on OSes that support it (OpenBSD and Cygwin do not)
|
||||||
if type -q getent; and getent hosts > /dev/null 2>&1 # test if 'getent hosts' works and redirect output so errors don't print
|
if type -q getent
|
||||||
|
and getent hosts >/dev/null 2>&1 # test if 'getent hosts' works and redirect output so errors don't print
|
||||||
# Ignore zero ips
|
# Ignore zero ips
|
||||||
getent hosts | string match -r -v '^0.0.0.0' \
|
getent hosts | string match -r -v '^0.0.0.0' | string replace -r '[0-9.]*\s*' '' | string split " "
|
||||||
| string replace -r '[0-9.]*\s*' '' | string split " "
|
|
||||||
else if test -r /etc/hosts
|
else if test -r /etc/hosts
|
||||||
# Ignore commented lines and functionally empty lines
|
# Ignore commented lines and functionally empty lines
|
||||||
string match -r -v '^\s*0.0.0.0|^\s*#|^\s*$' < /etc/hosts \
|
string match -r -v '^\s*0.0.0.0|^\s*#|^\s*$' </etc/hosts # Strip comments
|
||||||
# Strip comments
|
| string replace -ra '#.*$' '' | string replace -r '[0-9.]*\s*' '' | string trim | string replace -ra '\s+' '\n'
|
||||||
| string replace -ra '#.*$' '' \
|
end
|
||||||
| string replace -r '[0-9.]*\s*' '' | string trim | string replace -ra '\s+' '\n'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Print nfs servers from /etc/fstab
|
# Print nfs servers from /etc/fstab
|
||||||
if test -r /etc/fstab
|
if test -r /etc/fstab
|
||||||
string match -r '^\s*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3]:|^[a-zA-Z\.]*:' </etc/fstab | string replace -r ':.*' ''
|
string match -r '^\s*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3]:|^[a-zA-Z\.]*:' </etc/fstab | string replace -r ':.*' ''
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check hosts known to ssh
|
# Check hosts known to ssh
|
||||||
set -l known_hosts ~/.ssh/known_hosts{,2} /etc/ssh/known_hosts{,2} # Yes, seriously - the default specifies both with and without "2"
|
set -l known_hosts ~/.ssh/known_hosts{,2} /etc/ssh/known_hosts{,2} # Yes, seriously - the default specifies both with and without "2"
|
||||||
for file in /etc/ssh/ssh_config ~/.ssh/config
|
for file in /etc/ssh/ssh_config ~/.ssh/config
|
||||||
if test -r $file
|
if test -r $file
|
||||||
# Print hosts from system wide ssh configuration file
|
# Print hosts from system wide ssh configuration file
|
||||||
# Note the non-capturing group to avoid printing "name"
|
# Note the non-capturing group to avoid printing "name"
|
||||||
string match -ri '\s*Host(?:name)?(?:\s+|\s*=\s*)\w.*' < $file | string replace -ri '^\s*Host(?:name)?\s*(\S+)' '$1' \
|
string match -ri '\s*Host(?:name)?(?:\s+|\s*=\s*)\w.*' <$file | string replace -ri '^\s*Host(?:name)?\s*(\S+)' '$1' | string replace -r '\s+' ' ' | string split ' '
|
||||||
| string replace -r '\s+' ' ' | string split ' '
|
|
||||||
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \
|
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \
|
||||||
| string replace -ri '.*KnownHostsFile\s*' '')
|
| string replace -ri '.*KnownHostsFile\s*' '')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for file in $known_hosts
|
for file in $known_hosts
|
||||||
# Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200)
|
# Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200)
|
||||||
test -r $file; and string replace -ra '(\S+) .*' '$1' < $file | string match -r '^[^#|[=]+$' | string split ","
|
test -r $file
|
||||||
end
|
and string replace -ra '(\S+) .*' '$1' <$file | string match -r '^[^#|[=]+$' | string split ","
|
||||||
return 0
|
end
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function __fish_print_lpr_options --description 'Print lpr options'
|
function __fish_print_lpr_options --description 'Print lpr options'
|
||||||
lpoptions -l ^ /dev/null | sed 's+\(.*\)/\(.*\):.*$+\1\t\2+'
|
lpoptions -l ^/dev/null | sed 's+\(.*\)/\(.*\):.*$+\1\t\2+'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_print_lpr_printers --description 'Print lpr printers'
|
function __fish_print_lpr_printers --description 'Print lpr printers'
|
||||||
lpstat -p ^ /dev/null | sed 's/^\S*\s\(\S*\)\s\(.*\)$/\1\t\2/'
|
lpstat -p ^/dev/null | sed 's/^\S*\s\(\S*\)\s\(.*\)$/\1\t\2/'
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Helper function for completions that need to enumerate Linux modules
|
# Helper function for completions that need to enumerate Linux modules
|
||||||
function __fish_print_modules
|
function __fish_print_modules
|
||||||
find /lib/modules/(uname -r)/{kernel,misc} -type f ^ /dev/null | sed -e 's$/.*/\([^/.]*\).*$\1$'
|
find /lib/modules/(uname -r)/{kernel,misc} -type f ^/dev/null | sed -e 's$/.*/\([^/.]*\).*$\1$'
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,9 +5,8 @@ function __fish_print_mounted --description 'Print mounted devices'
|
||||||
# \011 encodes a tab, \012 encodes a newline and \\ encodes a backslash
|
# \011 encodes a tab, \012 encodes a newline and \\ encodes a backslash
|
||||||
# This will probably break on newlines because of our splitting, though
|
# This will probably break on newlines because of our splitting, though
|
||||||
# and tabs because of descriptions
|
# and tabs because of descriptions
|
||||||
string replace -r '\S+ (\S+) .*' '$1' </etc/mtab | string replace -a "\040" " " \
|
string replace -r '\S+ (\S+) .*' '$1' </etc/mtab | string replace -a "\040" " " | string replace -a "\011" \t | string replace -a "\012" \n | string replace -a "\\\\" "\\"
|
||||||
| string replace -a "\011" \t | string replace -a "\012" \n | string replace -a "\\\\" "\\"
|
|
||||||
else
|
else
|
||||||
mount | cut -d " " -f 1-3|tr " " \n|sed -e "s/[0-9\.]*:\//\//"| __fish_sgrep "^/"
|
mount | cut -d " " -f 1-3 | tr " " \n | sed -e "s/[0-9\.]*:\//\//" | __fish_sgrep "^/"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_print_ninja_targets
|
function __fish_print_ninja_targets
|
||||||
if [ -f build.ninja ]
|
if [ -f build.ninja ]
|
||||||
ninja -t targets 2> /dev/null | string replace -r ':.*' ''
|
ninja -t targets 2>/dev/null | string replace -r ':.*' ''
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,7 +73,7 @@ function __fish_print_packages
|
||||||
end
|
end
|
||||||
|
|
||||||
# Remove package version information from output and pipe into cache file
|
# Remove package version information from output and pipe into cache file
|
||||||
zypper --quiet --non-interactive search --type=package | tail -n +4 | sed -r 's/^. \| ((\w|[-_.])+).*/\1\t'$package'/g' > $cache_file &
|
zypper --quiet --non-interactive search --type=package | tail -n +4 | sed -r 's/^. \| ((\w|[-_.])+).*/\1\t'$package'/g' >$cache_file &
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ function __fish_print_packages
|
||||||
end
|
end
|
||||||
|
|
||||||
# Remove package version information from output and pipe into cache file
|
# Remove package version information from output and pipe into cache file
|
||||||
rpm -qa |sed -e 's/-[^-]*-[^-]*$/\t'$package'/' >$cache_file &
|
rpm -qa | sed -e 's/-[^-]*-[^-]*$/\t'$package'/' >$cache_file &
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ function __fish_print_packages
|
||||||
else
|
else
|
||||||
# FIXME? Seems to be broken
|
# FIXME? Seems to be broken
|
||||||
if type -q -f emerge
|
if type -q -f emerge
|
||||||
emerge -s \^(commandline -tc) | __fish_sgrep "^*" |cut -d\ -f3 |cut -d/ -f2
|
emerge -s \^(commandline -tc) | __fish_sgrep "^*" | cut -d\ -f3 | cut -d/ -f2
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function __fish_print_pacman_repos --description "Print the repositories configured for arch's pacman package manager"
|
function __fish_print_pacman_repos --description "Print the repositories configured for arch's pacman package manager"
|
||||||
string replace -r -a "\[(.+)\]" "\1" < /etc/pacman.conf | string match -r -v "^#|options"
|
string replace -r -a "\[(.+)\]" "\1" </etc/pacman.conf | string match -r -v "^#|options"
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ function __fish_print_users --description "Print a list of local users"
|
||||||
else if test -x /usr/bin/dscl # OS X support
|
else if test -x /usr/bin/dscl # OS X support
|
||||||
dscl . -list /Users | string match -r -v '^_'
|
dscl . -list /Users | string match -r -v '^_'
|
||||||
else
|
else
|
||||||
string match -v -r '^\w*#' < /etc/passwd | cut -d : -f 1
|
string match -v -r '^\w*#' </etc/passwd | cut -d : -f 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
switch (uname)
|
switch (uname)
|
||||||
case 'CYGWIN_*'
|
case 'CYGWIN_*'
|
||||||
function __fish_pwd --description "Show current path"
|
function __fish_pwd --description "Show current path"
|
||||||
pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u\1:/-'
|
pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u\1:/-'
|
||||||
end
|
end
|
||||||
case '*'
|
case '*'
|
||||||
function __fish_pwd --description "Show current path"
|
function __fish_pwd --description "Show current path"
|
||||||
pwd
|
pwd
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,13 +91,14 @@ end
|
||||||
|
|
||||||
function __fish_svn_prompt --description "Prompt function for svn"
|
function __fish_svn_prompt --description "Prompt function for svn"
|
||||||
# if svn isn't installed then don't do anything
|
# if svn isn't installed then don't do anything
|
||||||
if not command -s svn > /dev/null
|
if not command -s svn >/dev/null
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
# make sure that this is a svn repo
|
# make sure that this is a svn repo
|
||||||
set -l checkout_info (command svn info ^/dev/null)
|
set -l checkout_info (command svn info ^/dev/null)
|
||||||
if [ $status -ne 0 ];
|
if [ $status -ne 0 ]
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -122,7 +123,8 @@ function __fish_svn_prompt --description "Prompt function for svn"
|
||||||
set -l column_status (printf '%s\n' $svn_status_lines | cut -c $col | tr -d ' \n')
|
set -l column_status (printf '%s\n' $svn_status_lines | cut -c $col | tr -d ' \n')
|
||||||
|
|
||||||
# check that the character count is not zero (this would indicate that there are status flags in this column)
|
# check that the character count is not zero (this would indicate that there are status flags in this column)
|
||||||
if [ (count $column_status) -ne 0 ];
|
if [ (count $column_status) -ne 0 ]
|
||||||
|
|
||||||
# we only want to display unique status flags (eg: if there are 5 modified files, the prompt should only show the modified status once)
|
# we only want to display unique status flags (eg: if there are 5 modified files, the prompt should only show the modified status once)
|
||||||
set -l column_unique_status (echo $column_status | sort | uniq)
|
set -l column_unique_status (echo $column_status | sort | uniq)
|
||||||
# parse the status flags for this column and create the formatting by calling out to the helper function
|
# parse the status flags for this column and create the formatting by calling out to the helper function
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# Like for running machines, I'm assuming machinectl doesn't allow spaces in image names
|
# Like for running machines, I'm assuming machinectl doesn't allow spaces in image names
|
||||||
# This does not include the special image ".host" since it isn't valid for most operations
|
# This does not include the special image ".host" since it isn't valid for most operations
|
||||||
function __fish_systemd_machine_images
|
function __fish_systemd_machine_images
|
||||||
machinectl --no-legend --no-pager list-images | while read -l a b; echo $a; end
|
machinectl --no-legend --no-pager list-images | while read -l a b
|
||||||
|
echo $a
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# It seems machinectl will eliminate spaces from machine names so we don't need to handle that
|
# It seems machinectl will eliminate spaces from machine names so we don't need to handle that
|
||||||
function __fish_systemd_machines
|
function __fish_systemd_machines
|
||||||
machinectl --no-legend --no-pager list --all | while read -l a b; echo $a; end
|
machinectl --no-legend --no-pager list --all | while read -l a b
|
||||||
|
echo $a
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,5 +13,6 @@ function __fish_toggle_comment_commandline --description 'Comment/uncomment the
|
||||||
end
|
end
|
||||||
set -l cmdlines (printf '%s\n' '#'$cmdlines | string replace -r '^##' '')
|
set -l cmdlines (printf '%s\n' '#'$cmdlines | string replace -r '^##' '')
|
||||||
commandline -r $cmdlines
|
commandline -r $cmdlines
|
||||||
string match -q '#*' $cmdlines[1]; and commandline -f execute
|
string match -q '#*' $cmdlines[1]
|
||||||
|
and commandline -f execute
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,11 @@ function __fish_urlencode --description "URL-encode stdin"
|
||||||
set -l join ''
|
set -l join ''
|
||||||
set -l chars
|
set -l chars
|
||||||
# Set locale to C and IFS to "" in order to split a line into bytes.
|
# Set locale to C and IFS to "" in order to split a line into bytes.
|
||||||
while begin; set -lx LC_ALL C; set -lx IFS ''; read -az chars; end
|
while begin
|
||||||
|
set -lx LC_ALL C
|
||||||
|
set -lx IFS ''
|
||||||
|
read -az chars
|
||||||
|
end
|
||||||
printf '%s' $join
|
printf '%s' $join
|
||||||
# chomp off a trailing newline
|
# chomp off a trailing newline
|
||||||
if test "$chars[-1]" = \n
|
if test "$chars[-1]" = \n
|
||||||
|
|
|
@ -51,13 +51,20 @@ function __terlar_git_prompt --description 'Write out the git prompt'
|
||||||
end
|
end
|
||||||
|
|
||||||
switch $i
|
switch $i
|
||||||
case 'A ' ; set gs $gs added
|
case 'A '
|
||||||
case 'M ' ' M' ; set gs $gs modified
|
set gs $gs added
|
||||||
case 'R ' ; set gs $gs renamed
|
case 'M ' ' M'
|
||||||
case 'C ' ; set gs $gs copied
|
set gs $gs modified
|
||||||
case 'D ' ' D' ; set gs $gs deleted
|
case 'R '
|
||||||
case '\?\?' ; set gs $gs untracked
|
set gs $gs renamed
|
||||||
case 'U*' '*U' 'DD' 'AA'; set gs $gs unmerged
|
case 'C '
|
||||||
|
set gs $gs copied
|
||||||
|
case 'D ' ' D'
|
||||||
|
set gs $gs deleted
|
||||||
|
case '\?\?'
|
||||||
|
set gs $gs untracked
|
||||||
|
case 'U*' '*U' 'DD' 'AA'
|
||||||
|
set gs $gs unmerged
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -74,12 +74,14 @@ function abbr --description "Manage abbreviations"
|
||||||
case 'add'
|
case 'add'
|
||||||
# Convert from old "key=value" syntax
|
# Convert from old "key=value" syntax
|
||||||
# TODO: This should be removed later
|
# TODO: This should be removed later
|
||||||
if not set -q mode_arg[2]; and string match -qr '^[^ ]+=' -- $mode_arg
|
if not set -q mode_arg[2]
|
||||||
|
and string match -qr '^[^ ]+=' -- $mode_arg
|
||||||
set mode_arg (string split "=" -- $mode_arg)
|
set mode_arg (string split "=" -- $mode_arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Bail out early if the exact abbr is already in
|
# Bail out early if the exact abbr is already in
|
||||||
contains -- "$mode_arg" $fish_user_abbreviations; and return 0
|
contains -- "$mode_arg" $fish_user_abbreviations
|
||||||
|
and return 0
|
||||||
set -l key $mode_arg[1]
|
set -l key $mode_arg[1]
|
||||||
set -e mode_arg[1]
|
set -e mode_arg[1]
|
||||||
set -l value "$mode_arg"
|
set -l value "$mode_arg"
|
||||||
|
@ -122,7 +124,8 @@ function abbr --description "Manage abbreviations"
|
||||||
|
|
||||||
# Check to see if either key or value has a leading dash
|
# Check to see if either key or value has a leading dash
|
||||||
# If so, we need to write --
|
# If so, we need to write --
|
||||||
string match -q -- '-*' $key $value; and set opt_double_dash '--'
|
string match -q -- '-*' $key $value
|
||||||
|
and set opt_double_dash '--'
|
||||||
echo abbr $opt_double_dash (string escape -- $key $value)
|
echo abbr $opt_double_dash (string escape -- $key $value)
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function alias --description 'Creates a function wrapping a command'
|
function alias --description 'Creates a function wrapping a command'
|
||||||
if count $argv > /dev/null
|
if count $argv >/dev/null
|
||||||
switch $argv[1]
|
switch $argv[1]
|
||||||
case -h --h --he --hel --help
|
case -h --h --he --hel --help
|
||||||
__fish_print_help alias
|
__fish_print_help alias
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# check if command fish_indent works and is the same version that
|
# check if command fish_indent works and is the same version that
|
||||||
# came with this fish. This will happen one time.
|
# came with this fish. This will happen one time.
|
||||||
command -s fish_indent > /dev/null
|
command -s fish_indent >/dev/null
|
||||||
and command fish_indent --version 2>&1 | string match -rq $FISH_VERSION
|
and command fish_indent --version 2>&1 | string match -rq $FISH_VERSION
|
||||||
# if alias doesn't define the function here, this is an autoloaded "nothing".
|
# if alias doesn't define the function here, this is an autoloaded "nothing".
|
||||||
# the command (if there is one) will be used by default.
|
# the command (if there is one) will be used by default.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# check if command fish_key_reader works and is the same version that
|
# check if command fish_key_reader works and is the same version that
|
||||||
# came with this fish. This will happen one time.
|
# came with this fish. This will happen one time.
|
||||||
command -s fish_key_reader > /dev/null
|
command -s fish_key_reader >/dev/null
|
||||||
and command fish_key_reader --version 2>&1 | string match -rq $FISH_VERSION
|
and command fish_key_reader --version 2>&1 | string match -rq $FISH_VERSION
|
||||||
# if alias doesn't define the function here, this is an autoloaded "nothing".
|
# if alias doesn't define the function here, this is an autoloaded "nothing".
|
||||||
# the command (if there is one) will be used by default.
|
# the command (if there is one) will be used by default.
|
||||||
|
|
|
@ -16,7 +16,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
|
||||||
# We use the `tput` here just to see if terminfo thinks we can change the cursor.
|
# We use the `tput` here just to see if terminfo thinks we can change the cursor.
|
||||||
# We cannot use that sequence directly as it's not the correct one for konsole and iTerm,
|
# We cannot use that sequence directly as it's not the correct one for konsole and iTerm,
|
||||||
# and because we may want to change the cursor even though terminfo says we can't (tmux).
|
# and because we may want to change the cursor even though terminfo says we can't (tmux).
|
||||||
if not tput Ss > /dev/null ^/dev/null
|
if not tput Ss >/dev/null ^/dev/null
|
||||||
# Whitelist tmux...
|
# Whitelist tmux...
|
||||||
and not begin
|
and not begin
|
||||||
set -q TMUX
|
set -q TMUX
|
||||||
|
|
|
@ -69,7 +69,10 @@ function funced --description 'Edit function definition'
|
||||||
set editor fish
|
set editor fish
|
||||||
end
|
end
|
||||||
|
|
||||||
if begin; set -q interactive[1]; or test "$editor" = fish; end
|
if begin
|
||||||
|
set -q interactive[1]
|
||||||
|
or test "$editor" = fish
|
||||||
|
end
|
||||||
set -l IFS
|
set -l IFS
|
||||||
if functions -q -- $funcname
|
if functions -q -- $funcname
|
||||||
# Shadow IFS here to avoid array splitting in command substitution
|
# Shadow IFS here to avoid array splitting in command substitution
|
||||||
|
@ -89,14 +92,15 @@ function funced --description 'Edit function definition'
|
||||||
|
|
||||||
# OSX mktemp is rather restricted - no suffix, no way to automatically use TMPDIR
|
# OSX mktemp is rather restricted - no suffix, no way to automatically use TMPDIR
|
||||||
# Create a directory so we can use a ".fish" suffix for the file - makes editors pick up that it's a fish file
|
# Create a directory so we can use a ".fish" suffix for the file - makes editors pick up that it's a fish file
|
||||||
set -q TMPDIR; or set -l TMPDIR /tmp
|
set -q TMPDIR
|
||||||
|
or set -l TMPDIR /tmp
|
||||||
set -l tmpdir (mktemp -d $TMPDIR/fish.XXXXXX)
|
set -l tmpdir (mktemp -d $TMPDIR/fish.XXXXXX)
|
||||||
set -l tmpname $tmpdir/$funcname.fish
|
set -l tmpname $tmpdir/$funcname.fish
|
||||||
|
|
||||||
if functions -q -- $funcname
|
if functions -q -- $funcname
|
||||||
functions -- $funcname > $tmpname
|
functions -- $funcname >$tmpname
|
||||||
else
|
else
|
||||||
echo $init > $tmpname
|
echo $init >$tmpname
|
||||||
end
|
end
|
||||||
# Repeatedly edit until it either parses successfully, or the user cancels
|
# Repeatedly edit until it either parses successfully, or the user cancels
|
||||||
# If the editor command itself fails, we assume the user cancelled or the file
|
# If the editor command itself fails, we assume the user cancelled or the file
|
||||||
|
|
|
@ -31,7 +31,7 @@ function funcsave --description "Save the current definition of all specified fu
|
||||||
|
|
||||||
for i in $argv
|
for i in $argv
|
||||||
if functions -q -- $i
|
if functions -q -- $i
|
||||||
functions -- $i > $configdir/fish/functions/$i.fish
|
functions -- $i >$configdir/fish/functions/$i.fish
|
||||||
else
|
else
|
||||||
printf (_ "%s: Unknown function '%s'\n") funcsave $i
|
printf (_ "%s: Unknown function '%s'\n") funcsave $i
|
||||||
set res 1
|
set res 1
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Query for USERDOMAIN to shorten waiting times when OS isn't Windows.
|
# Query for USERDOMAIN to shorten waiting times when OS isn't Windows.
|
||||||
set -q USERDOMAIN
|
set -q USERDOMAIN
|
||||||
and switch (uname)
|
and switch (uname)
|
||||||
case 'CYGWIN_*'
|
case 'CYGWIN_*'
|
||||||
# Cygwin's hostname is broken when computer name contains Unicode
|
# Cygwin's hostname is broken when computer name contains Unicode
|
||||||
# characters. This hack "fixes" hostname in Cygwin.
|
# characters. This hack "fixes" hostname in Cygwin.
|
||||||
function hostname --description "Show or set the system's host name"
|
function hostname --description "Show or set the system's host name"
|
||||||
|
|
|
@ -7,7 +7,8 @@ function man --description "Format and display the on-line manual pages"
|
||||||
# Notice local but exported variable
|
# Notice local but exported variable
|
||||||
set -lx MANPATH (string join : $MANPATH)
|
set -lx MANPATH (string join : $MANPATH)
|
||||||
if test -z "$MANPATH"
|
if test -z "$MANPATH"
|
||||||
type -q manpath; and set MANPATH (command manpath)
|
type -q manpath
|
||||||
|
and set MANPATH (command manpath)
|
||||||
end
|
end
|
||||||
set -l fish_manpath (dirname $__fish_datadir)/fish/man
|
set -l fish_manpath (dirname $__fish_datadir)/fish/man
|
||||||
if test -d "$fish_manpath" -a -n "$MANPATH"
|
if test -d "$fish_manpath" -a -n "$MANPATH"
|
||||||
|
|
|
@ -12,7 +12,7 @@ function nextd --description "Move forward in the directory history"
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
set -l show_hist 0
|
set -l show_hist 0
|
||||||
set -l times 1
|
set -l times 1
|
||||||
if count $argv > /dev/null
|
if count $argv >/dev/null
|
||||||
for i in (seq (count $argv))
|
for i in (seq (count $argv))
|
||||||
switch $argv[$i]
|
switch $argv[$i]
|
||||||
case '-l' --l --li --lis --list
|
case '-l' --l --li --lis --list
|
||||||
|
@ -35,10 +35,11 @@ function nextd --description "Move forward in the directory history"
|
||||||
|
|
||||||
# Traverse history
|
# Traverse history
|
||||||
set -l code 1
|
set -l code 1
|
||||||
if count $times > /dev/null
|
if count $times >/dev/null
|
||||||
for i in (seq $times)
|
for i in (seq $times)
|
||||||
# Try one step backward
|
# Try one step backward
|
||||||
if __fish_move_last dirnext dirprev;
|
if __fish_move_last dirnext dirprev
|
||||||
|
|
||||||
# We consider it a success if we were able to do at least 1 step
|
# We consider it a success if we were able to do at least 1 step
|
||||||
# (low expectations are the key to happiness ;)
|
# (low expectations are the key to happiness ;)
|
||||||
set code 0
|
set code 0
|
||||||
|
|
|
@ -12,7 +12,7 @@ function prevd --description "Move back in the directory history"
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
set -l show_hist 0
|
set -l show_hist 0
|
||||||
set -l times 1
|
set -l times 1
|
||||||
if count $argv > /dev/null
|
if count $argv >/dev/null
|
||||||
for i in (seq (count $argv))
|
for i in (seq (count $argv))
|
||||||
switch $argv[$i]
|
switch $argv[$i]
|
||||||
case '-l' --l --li --lis --list
|
case '-l' --l --li --lis --list
|
||||||
|
@ -35,10 +35,11 @@ function prevd --description "Move back in the directory history"
|
||||||
|
|
||||||
# Traverse history
|
# Traverse history
|
||||||
set -l code 1
|
set -l code 1
|
||||||
if count $times > /dev/null
|
if count $times >/dev/null
|
||||||
for i in (seq $times)
|
for i in (seq $times)
|
||||||
# Try one step backward
|
# Try one step backward
|
||||||
if __fish_move_last dirprev dirnext;
|
if __fish_move_last dirprev dirnext
|
||||||
|
|
||||||
# We consider it a success if we were able to do at least 1 step
|
# We consider it a success if we were able to do at least 1 step
|
||||||
# (low expectations are the key to happiness ;)
|
# (low expectations are the key to happiness ;)
|
||||||
set code 0
|
set code 0
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
|
function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
|
||||||
set -q argv[1]; and switch $argv[1]
|
set -q argv[1]
|
||||||
|
and switch $argv[1]
|
||||||
case -h --help
|
case -h --help
|
||||||
__fish_print_help prompt_pwd
|
__fish_print_help prompt_pwd
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
# This allows overriding fish_prompt_pwd_dir_length from the outside (global or universal) without leaking it
|
# This allows overriding fish_prompt_pwd_dir_length from the outside (global or universal) without leaking it
|
||||||
set -q fish_prompt_pwd_dir_length; or set -l fish_prompt_pwd_dir_length 1
|
set -q fish_prompt_pwd_dir_length
|
||||||
|
or set -l fish_prompt_pwd_dir_length 1
|
||||||
|
|
||||||
# Replace $HOME with "~"
|
# Replace $HOME with "~"
|
||||||
set realhome ~
|
set realhome ~
|
||||||
|
|
|
@ -60,7 +60,8 @@ function psub --description "Read from stdin into a file and output the filename
|
||||||
# Write output to pipe. This needs to be done in the background so
|
# Write output to pipe. This needs to be done in the background so
|
||||||
# that the command substitution exits without needing to wait for
|
# that the command substitution exits without needing to wait for
|
||||||
# all the commands to exit
|
# all the commands to exit
|
||||||
set dirname (mktemp -d "$TMPDIR[1]"/.psub.XXXXXXXXXX); or return
|
set dirname (mktemp -d "$TMPDIR[1]"/.psub.XXXXXXXXXX)
|
||||||
|
or return
|
||||||
set filename $dirname/psub.fifo"$suffix"
|
set filename $dirname/psub.fifo"$suffix"
|
||||||
mkfifo $filename
|
mkfifo $filename
|
||||||
cat >$filename &
|
cat >$filename &
|
||||||
|
@ -78,9 +79,11 @@ function psub --description "Read from stdin into a file and output the filename
|
||||||
|
|
||||||
# Find unique function name
|
# Find unique function name
|
||||||
while true
|
while true
|
||||||
set funcname __fish_psub_(random);
|
set funcname __fish_psub_(random)
|
||||||
|
|
||||||
if not functions $funcname >/dev/null ^/dev/null
|
if not functions $funcname >/dev/null ^/dev/null
|
||||||
break;
|
break
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
function suspend -d "Suspend the current shell."
|
function suspend -d "Suspend the current shell."
|
||||||
if contains -- $argv --help; or contains -- $argv -h
|
if contains -- $argv --help
|
||||||
|
or contains -- $argv -h
|
||||||
__fish_print_help suspend
|
__fish_print_help suspend
|
||||||
and return 0
|
and return 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ function trap -d 'Perform an action when the shell receives a signal'
|
||||||
set -l options
|
set -l options
|
||||||
set -l longopt
|
set -l longopt
|
||||||
set -l shortopt lph
|
set -l shortopt lph
|
||||||
if not getopt -T > /dev/null
|
if not getopt -T >/dev/null
|
||||||
# GNU getopt
|
# GNU getopt
|
||||||
set longopt print,help,list-signals
|
set longopt print,help,list-signals
|
||||||
set options -o $shortopt -l $longopt --
|
set options -o $shortopt -l $longopt --
|
||||||
|
|
|
@ -143,7 +143,10 @@ function type --description "Print the type of a command"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if begin; test $found = 0; and test $mode != quiet; end
|
if begin
|
||||||
|
test $found = 0
|
||||||
|
and test $mode != quiet
|
||||||
|
end
|
||||||
printf (_ "%s: Could not find '%s'\n") type $i >&2
|
printf (_ "%s: Could not find '%s'\n") type $i >&2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,9 @@ function __fish_umask_parse -d "Internal umask function"
|
||||||
# Test if already a valid octal mask, and pad it with zeros
|
# Test if already a valid octal mask, and pad it with zeros
|
||||||
if echo $argv | __fish_sgrep -E '^0?[0-7]{1,3}$' >/dev/null
|
if echo $argv | __fish_sgrep -E '^0?[0-7]{1,3}$' >/dev/null
|
||||||
set -l char_count (echo $argv| wc -c)
|
set -l char_count (echo $argv| wc -c)
|
||||||
for i in (seq (math 5 - $char_count)); set argv 0$argv; end
|
for i in (seq (math 5 - $char_count))
|
||||||
|
set argv 0$argv
|
||||||
|
end
|
||||||
echo $argv
|
echo $argv
|
||||||
else
|
else
|
||||||
# Test if argument really is a valid symbolic mask
|
# Test if argument really is a valid symbolic mask
|
||||||
|
@ -72,7 +74,7 @@ function __fish_umask_parse -d "Internal umask function"
|
||||||
set mode set
|
set mode set
|
||||||
end
|
end
|
||||||
|
|
||||||
if not echo $perm| __fish_sgrep -E '^(r|w|x)*$' >/dev/null
|
if not echo $perm | __fish_sgrep -E '^(r|w|x)*$' >/dev/null
|
||||||
printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2
|
printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -131,7 +133,7 @@ function __fish_umask_print_symbolic
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
echo $res|cut -c 2-
|
echo $res | cut -c 2-
|
||||||
end
|
end
|
||||||
|
|
||||||
function umask --description "Set default file permission mask"
|
function umask --description "Set default file permission mask"
|
||||||
|
|
Loading…
Reference in a new issue