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:
Kurtis Rader 2016-11-27 21:27:22 -08:00
parent 54a76bb9e5
commit 11a60c8374
161 changed files with 2638 additions and 2587 deletions

View file

@ -1,6 +1,6 @@
function N_ --description "No-op" function N_ --description "No-op"
printf "%s" $argv printf "%s" $argv
end end

View file

@ -1,7 +1,7 @@
function __fish_append -d "Internal completion function for appending string to the commandline" --argument separator function __fish_append -d "Internal completion function for appending string to the commandline" --argument separator
set -e argv[1] set -e argv[1]
set str (commandline -tc| sed -ne "s/\(.*$separator\)[^$separator]*/\1/p"|sed -e "s/--.*=//") set str (commandline -tc| sed -ne "s/\(.*$separator\)[^$separator]*/\1/p"|sed -e "s/--.*=//")
printf "%s\n" "$str"$argv "$str"(printf "%s\n" $argv|sed -e "s/\(\t\|\$\)/,\1/") printf "%s\n" "$str"$argv "$str"(printf "%s\n" $argv|sed -e "s/\(\t\|\$\)/,\1/")
end end

View file

@ -5,21 +5,21 @@ function __fish_bind_test1
for i in (commandline -poc) for i in (commandline -poc)
switch $i switch $i
case -k --k --ke --key case -k --k --ke --key
set use_keys yes set use_keys yes
case "-*" case "-*"
case "*" case "*"
set args $args $i set args $args $i
end end
end end
switch $use_keys switch $use_keys
case yes case yes
switch (count $args) switch (count $args)
case 1 case 1
return 0 return 0
end end
end end
return 1 return 1
end end

View file

@ -1,20 +1,20 @@
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
return 0 return 0
end end
return 1 return 1
end end

View file

@ -5,10 +5,10 @@ function __fish_commandline_test
for i in (commandline -poc) for i in (commandline -poc)
switch $i switch $i
case -f --f --fu --fun --func --funct --functi --functio --function case -f --f --fu --fun --func --funct --functi --functio --function
set is_function yes set is_function yes
case -- case --
break break
end end
@ -16,7 +16,7 @@ function __fish_commandline_test
switch $is_function switch $is_function
case yes case yes
return 0 return 0
end end
return 1 return 1

View file

@ -2,11 +2,11 @@ function __fish_complete_abook_formats --description 'Complete abook formats'
set -l pat set -l pat
switch $argv[1] switch $argv[1]
case in case in
set pat '/output:/,$d; /input:\|^$/d' set pat '/output:/,$d; /input:\|^$/d'
case out case out
set pat '/input:/,/output:/d; /^$/d' set pat '/input:/,/output:/d; /^$/d'
case '*' case '*'
return 1 return 1
end end
abook --formats | sed -e $pat -e 's/^\s\+//' abook --formats | sed -e $pat -e 's/^\s\+//'

View file

@ -1,15 +1,16 @@
function __fish_complete_ant_targets -d "Print list of targets from build.xml and imported files" function __fish_complete_ant_targets -d "Print list of targets from build.xml and imported files"
set -l buildfile "build.xml" set -l buildfile "build.xml"
if test -f $buildfile if test -f $buildfile
# show ant targets # show ant targets
__fish_filter_ant_targets $buildfile __fish_filter_ant_targets $buildfile
# find files with buildfile # find files with buildfile
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
end __fish_filter_ant_targets $file
end end
end
end end

View file

@ -1,20 +1,20 @@
function __fish_complete_atool_archive_contents --description 'List archive contents' function __fish_complete_atool_archive_contents --description 'List archive contents'
set -l cmd (commandline -cop) set -l cmd (commandline -cop)
set -e cmd[1] set -e cmd[1]
set -l file set -l file
for arg in $cmd for arg in $cmd
switch $arg switch $arg
case '-*' case '-*'
case '*' case '*'
if test -f $arg if test -f $arg
set file $arg set file $arg
break break
end end
end end
end end
if not set -q file[1] if not set -q file[1]
return return
end end
als $file -qq | sed -r 's/^\s*[0-9]+\s+[0-9-]+\s+[0-9:]+\s+(.*)$/\1/' als $file -qq | sed -r 's/^\s*[0-9]+\s+[0-9-]+\s+[0-9:]+\s+(.*)$/\1/'
end end

View file

@ -1,33 +1,33 @@
# Bittorrent commands # Bittorrent commands
function __fish_complete_bittorrent function __fish_complete_bittorrent
complete -c $argv -l max_uploads -x --description "Maximum uploads at once" complete -c $argv -l max_uploads -x --description "Maximum uploads at once"
complete -c $argv -l keepalive_interval -x --description "Number of seconds between keepalives" complete -c $argv -l keepalive_interval -x --description "Number of seconds between keepalives"
complete -c $argv -l download_slice_size -x --description "Bytes per request" complete -c $argv -l download_slice_size -x --description "Bytes per request"
complete -c $argv -l request_backlog -x --description "Requests per pipe" complete -c $argv -l request_backlog -x --description "Requests per pipe"
complete -c $argv -l max_message_length -x --description "Maximum length prefix encoding" complete -c $argv -l max_message_length -x --description "Maximum length prefix encoding"
complete -c $argv -l ip --description "IP to report to the tracker" -x -a "(__fish_print_addresses)" complete -c $argv -l ip --description "IP to report to the tracker" -x -a "(__fish_print_addresses)"
complete -c $argv -l minport --description "Minimum port to listen to" complete -c $argv -l minport --description "Minimum port to listen to"
complete -c $argv -l maxport --description "Maximum port to listen to" complete -c $argv -l maxport --description "Maximum port to listen to"
complete -c $argv -l responsefile -r --description "File for server response" complete -c $argv -l responsefile -r --description "File for server response"
complete -c $argv -l url -x --description "URL to get file from" complete -c $argv -l url -x --description "URL to get file from"
complete -c $argv -l saveas -r --description "Local file target" complete -c $argv -l saveas -r --description "Local file target"
complete -c $argv -l timeout -x --description "Time to close inactive socket" complete -c $argv -l timeout -x --description "Time to close inactive socket"
complete -c $argv -l timeout_check_interval -x --description "Time between checking timeouts" complete -c $argv -l timeout_check_interval -x --description "Time between checking timeouts"
complete -c $argv -l max_slice_length -x --description "Maximum outgoing slice length" complete -c $argv -l max_slice_length -x --description "Maximum outgoing slice length"
complete -c $argv -l max_rate_period -x --description "Maximum time to guess rate" complete -c $argv -l max_rate_period -x --description "Maximum time to guess rate"
complete -c $argv -l bind -x --description "IP to bind to locally" -a "(__fish_print_addresses)" complete -c $argv -l bind -x --description "IP to bind to locally" -a "(__fish_print_addresses)"
complete -c $argv -l display_interval -x --description "Time between screen updates" complete -c $argv -l display_interval -x --description "Time between screen updates"
complete -c $argv -l rerequest_interval -x --description "Time to wait between requesting more peers" complete -c $argv -l rerequest_interval -x --description "Time to wait between requesting more peers"
complete -c $argv -l min_peers -x --description "Minimum number of peers to not do requesting" complete -c $argv -l min_peers -x --description "Minimum number of peers to not do requesting"
complete -c $argv -l http_timeout -x --description "Number of seconds before assuming http timeout" complete -c $argv -l http_timeout -x --description "Number of seconds before assuming http timeout"
complete -c $argv -l max_initiate -x --description "Number of peers at which to stop initiating new connections" complete -c $argv -l max_initiate -x --description "Number of peers at which to stop initiating new connections"
complete -c $argv -l max_allow_in -x --description "Maximum number of connections to allow" complete -c $argv -l max_allow_in -x --description "Maximum number of connections to allow"
complete -c $argv -l check_hashes -x --description "Whether to check hashes on disk" complete -c $argv -l check_hashes -x --description "Whether to check hashes on disk"
complete -c $argv -l max_upload_rate -x --description "Maximum kB/s to upload at" complete -c $argv -l max_upload_rate -x --description "Maximum kB/s to upload at"
complete -c $argv -l snub_time -x --description "Seconds to wait for data to come in before assuming choking" complete -c $argv -l snub_time -x --description "Seconds to wait for data to come in before assuming choking"
complete -c $argv -l spew -x --description "Whether to display diagnostic info" complete -c $argv -l spew -x --description "Whether to display diagnostic info"
complete -c $argv -l rarest_first_cutoff -x --description "Number of downloads at which to switch from random to rarest first" complete -c $argv -l rarest_first_cutoff -x --description "Number of downloads at which to switch from random to rarest first"
complete -c $argv -l min_uploads -x --description "Number of uploads to fill out to with optimistic unchokes" complete -c $argv -l min_uploads -x --description "Number of uploads to fill out to with optimistic unchokes"
complete -c $argv -l report_hash_failiures -x --description "Whether to inform the user that hash failures occur" complete -c $argv -l report_hash_failiures -x --description "Whether to inform the user that hash failures occur"
end end

View file

@ -1,32 +1,36 @@
function __fish_complete_cd -d "Completions for the cd command" function __fish_complete_cd -d "Completions for the cd command"
set -l token (commandline -ct) set -l token (commandline -ct)
# Absolute path or explicitly from the current directory - no descriptions and no CDPATH # Absolute path or explicitly from the current directory - no descriptions and no CDPATH
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 ]
end and printf "%s\n" $d
else # Relative path - check $CDPATH and use that as description end
set -l cdpath $CDPATH else # Relative path - check $CDPATH and use that as description
[ -z "$cdpath" ]; and set cdpath "." set -l cdpath $CDPATH
# Remove the real path to "." (i.e. $PWD) from cdpath if we're in it [ -z "$cdpath" ]
# so it doesn't get printed in the descriptions and set cdpath "."
if set -l ind (contains -i -- $PWD $cdpath) # Remove the real path to "." (i.e. $PWD) from cdpath if we're in it
and contains -- "." $cdpath # so it doesn't get printed in the descriptions
set -e cdpath[$ind] if set -l ind (contains -i -- $PWD $cdpath)
end and contains -- "." $cdpath
# TODO: There's a subtlety regarding descriptions - if $cdpath[1]/foo and $cdpath[2]/foo exist, we print both set -e cdpath[$ind]
# but want the first description to win - this currently works, but is not guaranteed end
for i in $cdpath # TODO: There's a subtlety regarding descriptions - if $cdpath[1]/foo and $cdpath[2]/foo exist, we print both
set -l desc # but want the first description to win - this currently works, but is not guaranteed
# Don't show description for current directory for i in $cdpath
# and replace $HOME with "~" set -l desc
[ $i = "." ]; or set -l desc (string replace -r -- "^$HOME" "~" "$i") # Don't show description for current directory
# This assumes the CDPATH component itself is cd-able # and replace $HOME with "~"
for d in $i/$token*/ [ $i = "." ]
# Remove the cdpath component again or set -l desc (string replace -r -- "^$HOME" "~" "$i")
[ -x $d ]; and printf "%s\t%s\n" (string replace -r "^$i/" "" -- $d) $desc # This assumes the CDPATH component itself is cd-able
end for d in $i/$token*/
end # Remove the cdpath component again
end [ -x $d ]
and printf "%s\t%s\n" (string replace -r "^$i/" "" -- $d) $desc
end
end
end
end end

View file

@ -1,10 +1,10 @@
function __fish_complete_command --description 'Complete using all available commands' function __fish_complete_command --description 'Complete using all available commands'
set -l ctoken (commandline -ct) set -l ctoken (commandline -ct)
switch $ctoken switch $ctoken
case '*=*' case '*=*'
set ctoken (string split "=" -- $ctoken) set ctoken (string split "=" -- $ctoken)
printf '%s\n' $ctoken[1]=(complete -C$ctoken[2]) printf '%s\n' $ctoken[1]=(complete -C$ctoken[2])
case '*' case '*'
complete -C$ctoken complete -C$ctoken
end end
end end

View file

@ -1,16 +1,16 @@
function __fish_complete_convert_options --description 'Complete Convert options' --argument what function __fish_complete_convert_options --description 'Complete Convert options' --argument what
switch $what switch $what
case format Format case format Format
convert -list Format | sed '1,/----/d; /^$/,$d; /^$/d; s/^\s*\([a-zA-Z0-9-]\+\)\**\s*\S\+\s\+\\(\S\+\)\s\+\(.\+\S\)\s*$/\1\t\2 \3/' convert -list Format | sed '1,/----/d; /^$/,$d; /^$/d; s/^\s*\([a-zA-Z0-9-]\+\)\**\s*\S\+\s\+\\(\S\+\)\s\+\(.\+\S\)\s*$/\1\t\2 \3/'
case color Color case color Color
convert -list color | awk '{ print $1"\t"$2" "$3} ' | sed '1,/----/d' convert -list color | awk '{ print $1"\t"$2" "$3} ' | sed '1,/----/d'
case family case family
convert -list Font | grep family | sed 's/^\s*.\+: //' | sort -u convert -list Font | grep family | sed 's/^\s*.\+: //' | sort -u
case font Font case font Font
convert -list Font | grep Font | sed 's/^\s*.\+: //' | sort -u convert -list Font | grep Font | sed 's/^\s*.\+: //' | sort -u
case '*' case '*'
convert -list $what convert -list $what
end end
end end

View file

@ -5,17 +5,17 @@
function __fish_complete_directories -d "Complete using directories" --argument comp function __fish_complete_directories -d "Complete using directories" --argument comp
set desc (_ Directory) set desc (_ Directory)
if test (count $argv) -gt 1 if test (count $argv) -gt 1
set desc $argv[2] set desc $argv[2]
end end
eval "set dirs "$comp"*/" eval "set dirs "$comp"*/"
if test $dirs[1] if test $dirs[1]
printf "%s\t$desc\n" $dirs printf "%s\t$desc\n" $dirs
end end
end end

View file

@ -1,20 +1,20 @@
function __fish_complete_file_url function __fish_complete_file_url
set -l comp set -l comp
if set -q argv[1] if set -q argv[1]
set comp $argv[1] set comp $argv[1]
else else
set comp (commandline -ct) set comp (commandline -ct)
end end
set -l prefix (echo $comp|cut -c 1-7) set -l prefix (echo $comp|cut -c 1-7)
if test file:// = $prefix if test file:// = $prefix
set -l stripped (echo $comp|cut -c 8-) set -l stripped (echo $comp|cut -c 8-)
printf "%s\n" file://(complete -C"echo $stripped") printf "%s\n" file://(complete -C"echo $stripped")
else else
echo file:// echo file://
end end
end end

View file

@ -1,14 +1,14 @@
function __fish_complete_ftp -d 'Complete ftp, pftp' --argument-names ftp function __fish_complete_ftp -d 'Complete ftp, pftp' --argument-names ftp
complete -c $ftp -xa "(__fish_print_hostnames)" -d 'Hostname' complete -c $ftp -xa "(__fish_print_hostnames)" -d 'Hostname'
complete -c $ftp -s 4 -d 'Use only IPv4 to contact any host' complete -c $ftp -s 4 -d 'Use only IPv4 to contact any host'
complete -c $ftp -s 6 -d 'Use IPv6 only' complete -c $ftp -s 6 -d 'Use IPv6 only'
complete -c $ftp -s p -d 'Use passive mode for data transfers' complete -c $ftp -s p -d 'Use passive mode for data transfers'
complete -c $ftp -s A -d 'Use active mode for data transfers' complete -c $ftp -s A -d 'Use active mode for data transfers'
complete -c $ftp -s i -d 'Turn off interactive prompting during multiple file transfers.' complete -c $ftp -s i -d 'Turn off interactive prompting during multiple file transfers.'
complete -c $ftp -s n -d 'Restrain ftp from attempting "auto-login" upon initial connection' complete -c $ftp -s n -d 'Restrain ftp from attempting "auto-login" upon initial connection'
complete -c $ftp -s e -d 'Disable command editing and history support' complete -c $ftp -s e -d 'Disable command editing and history support'
complete -c $ftp -s g -d 'Disable file name globbing' complete -c $ftp -s g -d 'Disable file name globbing'
complete -c $ftp -s m -d 'Do not explicitly bind data and control channels to same interface' complete -c $ftp -s m -d 'Do not explicitly bind data and control channels to same interface'
complete -c $ftp -s v -d 'Verbose. Show all server responses and data transfer stats' complete -c $ftp -s v -d 'Verbose. Show all server responses and data transfer stats'
complete -c $ftp -s d -d 'Enable debugging' complete -c $ftp -s d -d 'Enable debugging'
end end

View file

@ -1,8 +1,8 @@
function __fish_complete_groups --description "Print a list of local groups, with group members as the description" function __fish_complete_groups --description "Print a list of local groups, with group members as the description"
if command -s getent >/dev/null if command -s getent >/dev/null
getent group | cut -d ':' -f 1,4 | sed 's/:/\t/' getent group | cut -d ':' -f 1,4 | sed 's/:/\t/'
else else
cut -d ':' -f 1,4 /etc/group | sed 's/:/\t/' cut -d ':' -f 1,4 /etc/group | sed 's/:/\t/'
end end
end end

View file

@ -1,30 +1,30 @@
function __fish_complete_list --argument div cmd prefix iprefix function __fish_complete_list --argument div cmd prefix iprefix
if not set -q cmd[1] if not set -q cmd[1]
echo "Usage: echo "Usage:
__fish_complete_list <separator> <function> <prefix> <itemprefix> __fish_complete_list <separator> <function> <prefix> <itemprefix>
where: 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]
or set -l iprefix "" or set -l iprefix ""
set -q prefix[1] set -q prefix[1]
or set -l prefix "" or set -l prefix ""
set -l pat (commandline -t) set -l pat (commandline -t)
#set -l pat $argv[5] #set -l pat $argv[5]
switch $pat switch $pat
case "*$div*" case "*$div*"
for i in (echo $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd) for i in (echo $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
echo $i echo $i
end end
case '*' case '*'
for i in $prefix$iprefix(eval $cmd) for i in $prefix$iprefix(eval $cmd)
echo $i echo $i
end end
end end
end end

View file

@ -4,35 +4,35 @@ function __fish_complete_lpr -d 'Complete lpr common options' --argument-names c
switch $cmd switch $cmd
case lpr lpq lprm case lpr lpq lprm
complete -c $cmd -s P -d 'Specifies an alternate printer or class name' -xa '(__fish_print_lpr_printers)' complete -c $cmd -s P -d 'Specifies an alternate printer or class name' -xa '(__fish_print_lpr_printers)'
end end
switch $cmd switch $cmd
case lpq cancel case lpq cancel
complete -c $cmd -s a -d 'Apply command to all printers' complete -c $cmd -s a -d 'Apply command to all printers'
end end
switch $cmd switch $cmd
case lpq cancel lpmove lpstat lprm lpoptions lp reject accept cupsaccept cupsreject cupsenable cupsdisable case lpq cancel lpmove lpstat lprm lpoptions lp reject accept cupsaccept cupsreject cupsenable cupsdisable
complete -c $cmd -s h -d 'Specifies an alternate server' -xa '(__fish_print_hostnames)' complete -c $cmd -s h -d 'Specifies an alternate server' -xa '(__fish_print_hostnames)'
end end
switch $cmd switch $cmd
case lp lpr case lp lpr
complete -c $cmd -s o -d 'Sets a job option' -xa '(__fish_complete_lpr_option)' complete -c $cmd -s o -d 'Sets a job option' -xa '(__fish_complete_lpr_option)'
complete -c $cmd -s m -d 'Send an email on job completion' complete -c $cmd -s m -d 'Send an email on job completion'
complete -c $cmd -s o -xa landscape -d 'Landscape mode' complete -c $cmd -s o -xa landscape -d 'Landscape mode'
complete -c $cmd -s o -xa "media=a4 media=letter media=legal" -d 'Media size' complete -c $cmd -s o -xa "media=a4 media=letter media=legal" -d 'Media size'
complete -c $cmd -s o -xa page-ranges= -d 'Page ranges' complete -c $cmd -s o -xa page-ranges= -d 'Page ranges'
complete -c $cmd -s o -xa orientation-requested= -d 'Choose orientation (4-landscape)' complete -c $cmd -s o -xa orientation-requested= -d 'Choose orientation (4-landscape)'
complete -c $cmd -s o -xa 'sides-one-sided two-sided-long-edge two-sided-short-edge' -d 'Choose between one/two sided modes' complete -c $cmd -s o -xa 'sides-one-sided two-sided-long-edge two-sided-short-edge' -d 'Choose between one/two sided modes'
complete -c $cmd -s o -xa fitplot -d 'Scale the print file to fit on the page' complete -c $cmd -s o -xa fitplot -d 'Scale the print file to fit on the page'
complete -c $cmd -s o -xa 'number-up=2 number-up=4 number-up=6 number-up=9' -d 'Print multiple document pages on each output page' complete -c $cmd -s o -xa 'number-up=2 number-up=4 number-up=6 number-up=9' -d 'Print multiple document pages on each output page'
complete -c $cmd -s o -xa 'scaling=' -d 'Scale image files to use up to number percent of the page' complete -c $cmd -s o -xa 'scaling=' -d 'Scale image files to use up to number percent of the page'
complete -c $cmd -s o -xa 'cpi=' -d 'Set the number of characters per inch to use' complete -c $cmd -s o -xa 'cpi=' -d 'Set the number of characters per inch to use'
complete -c $cmd -s o -xa 'lpi=' -d 'Set the number of lines per inch to use' complete -c $cmd -s o -xa 'lpi=' -d 'Set the number of lines per inch to use'
complete -c $cmd -s o -xa 'page-bottom= page-left= page-right= page-top=' -d 'Set the page margins when printing text files' complete -c $cmd -s o -xa 'page-bottom= page-left= page-right= page-top=' -d 'Set the page margins when printing text files'
end end
end end

View file

@ -1,25 +1,25 @@
function __fish_complete_lpr_option --description 'Complete lpr option' function __fish_complete_lpr_option --description 'Complete lpr option'
set -l optstr (commandline -t) set -l optstr (commandline -t)
switch $optstr switch $optstr
case '*=*' case '*=*'
set -l IFS = set -l IFS =
echo $optstr | read -l opt val echo $optstr | read -l opt val
set -l descr set -l descr
for l in (lpoptions -l ^/dev/null | string match -- "*$opt*" | string replace -r '.*/(.*):\s*(.*)$' '$1 $2' | string split " ") for l in (lpoptions -l ^/dev/null | string match -- "*$opt*" | string replace -r '.*/(.*):\s*(.*)$' '$1 $2' | string split " ")
if not set -q descr[1] if not set -q descr[1]
set descr $l set descr $l
continue continue
end end
set -l default '' set -l default ''
if string match -q '\**' -- $l if string match -q '\**' -- $l
set default 'Default ' set default 'Default '
set l (string sub -s 2 -- $l) set l (string sub -s 2 -- $l)
end end
echo $opt=$l\t$default$descr echo $opt=$l\t$default$descr
end end
case '*' case '*'
lpoptions -l ^/dev/null | string replace -r '(.*)/(.*):.*$' '$1=\t$2' lpoptions -l ^/dev/null | string replace -r '(.*)/(.*):.*$' '$1=\t$2'
end end
end end

View file

@ -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

View file

@ -1,20 +1,20 @@
function __fish_complete_man function __fish_complete_man
# Try to guess what section to search in. If we don't know, we # Try to guess what section to search in. If we don't know, we
# use [^)]*, which should match any section # use [^)]*, which should match any section
set section "" set section ""
set prev (commandline -poc) set prev (commandline -poc)
set -e prev[1] set -e prev[1]
while set -q prev[1] while set -q prev[1]
switch $prev[1] switch $prev[1]
case '-**' case '-**'
case '*' case '*'
set section $prev[1] set section $prev[1]
end end
set -e prev[1] set -e prev[1]
end end
set section $section"[^)]*" set section $section"[^)]*"
@ -25,9 +25,9 @@ function __fish_complete_man
set token "." set token "."
end end
if test -n "$token" if test -n "$token"
# Do the actual search # Do the actual search
apropos $token ^/dev/null | awk ' apropos $token ^/dev/null | awk '
BEGIN { FS="[\t ]- "; OFS="\t"; } BEGIN { FS="[\t ]- "; OFS="\t"; }
# BSD/Darwin # BSD/Darwin
/^[^( \t]+\('$section'\)/ { /^[^( \t]+\('$section'\)/ {
@ -66,7 +66,7 @@ function __fish_complete_man
' '
else else
return 1 return 1
end end
return 0 return 0
end end

View file

@ -1,14 +1,14 @@
function __fish_complete_path --description "Complete using path" function __fish_complete_path --description "Complete using path"
set -l target set -l target
set -l description set -l description
switch (count $argv) switch (count $argv)
case 0 case 0
# pass # pass
case 1 case 1
set target "$argv[1]" set target "$argv[1]"
case 2 "*" case 2 "*"
set target "$argv[1]" set target "$argv[1]"
set description "$argv[2]" set description "$argv[2]"
end end
printf "%s\t$description\n" (command ls -dp "$target"*) printf "%s\t$description\n" (command ls -dp "$target"*)
end end

View file

@ -3,14 +3,14 @@ function __fish_complete_pgrep -d 'Complete pgrep/pkill' --argument-names cmd
complete -c $cmd -xa '(__fish_complete_proc)' complete -c $cmd -xa '(__fish_complete_proc)'
complete -c $cmd -s f -d 'Match pattern against full command line' complete -c $cmd -s f -d 'Match pattern against full command line'
complete -c $cmd -s g -d 'Only match processes in the process group' -xa '(__fish_complete_list , __fish_complete_groups)' complete -c $cmd -s g -d 'Only match processes in the process group' -xa '(__fish_complete_list , __fish_complete_groups)'
complete -c $cmd -s G -d "Only match processes whose real group ID is listed. Group 0 is translated into $cmd\'s own process group" -xa '(__fish_complete_list , __fish_complete_groups)' complete -c $cmd -s G -d "Only match processes whose real group ID is listed. Group 0 is translated into $cmd\'s own process group" -xa '(__fish_complete_list , __fish_complete_groups)'
complete -c $cmd -s n -d 'Select only the newest process' complete -c $cmd -s n -d 'Select only the newest process'
complete -c $cmd -s o -d 'Select only the oldest process' complete -c $cmd -s o -d 'Select only the oldest process'
complete -c $cmd -s P -d 'Only match processes whose parent process ID is listed' -xa '(__fish_complete_list , __fish_complete_pids)' complete -c $cmd -s P -d 'Only match processes whose parent process ID is listed' -xa '(__fish_complete_list , __fish_complete_pids)'
complete -c $cmd -s s -d "Only match processes whose process session ID is listed. Session ID 0 is translated into $cmd\'s own session ID." complete -c $cmd -s s -d "Only match processes whose process session ID is listed. Session ID 0 is translated into $cmd\'s own session ID."
complete -c $cmd -s t -d 'Only match processes whose controlling terminal is listed. The terminal name should be specified without the "/dev/" prefix' -r complete -c $cmd -s t -d 'Only match processes whose controlling terminal is listed. The terminal name should be specified without the "/dev/" prefix' -r
complete -c $cmd -s u -d 'Only match processes whose effective user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)' complete -c $cmd -s u -d 'Only match processes whose effective user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)'
complete -c $cmd -s U -d 'Only match processes whose real user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)' complete -c $cmd -s U -d 'Only match processes whose real user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)'
complete -c $cmd -s v -d 'Negates the matching' complete -c $cmd -s v -d 'Negates the matching'
complete -c $cmd -s x -d ' Only match processes whose name (or command line if -f is specified) exactly match the pattern' complete -c $cmd -s x -d ' Only match processes whose name (or command line if -f is specified) exactly match the pattern'
end end

View file

@ -1,11 +1,11 @@
function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions" function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions"
# This may be a bit slower, but it's nice - having the tty displayed is really handy # This may be a bit slower, but it's nice - having the tty displayed is really handy
# 'tail -n +2' deletes the first line, which contains the headers # 'tail -n +2' deletes the first line, which contains the headers
# %self is removed from output by string match -r -v # %self is removed from output by string match -r -v
set -l SELF %self set -l SELF %self
# Display the tty if available # Display the tty if available
# But not if it's just question marks, meaning no tty # But not if it's just question marks, meaning no tty
ps axc -o pid,ucomm,tty | string match -r -v '^\s*'$SELF'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' '' ps axc -o pid,ucomm,tty | string match -r -v '^\s*'$SELF'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
end end

View file

@ -1,4 +1,4 @@
function __fish_complete_ppp_peer --description 'Complete isp name for pon/poff' function __fish_complete_ppp_peer --description 'Complete isp name for pon/poff'
find /etc/ppp/peers/ -type f -printf '%f\n' find /etc/ppp/peers/ -type f -printf '%f\n'
end end

View file

@ -1,47 +1,47 @@
function __fish_complete_proc --description 'Complete by list of running processes' function __fish_complete_proc --description 'Complete by list of running processes'
# Our function runs ps, followed by a massive list of commands passed to sed # Our function runs ps, followed by a massive list of commands passed to sed
set -l ps_cmd set -l ps_cmd
set -l sed_cmds set -l sed_cmds
if test (uname) = Linux if test (uname) = Linux
# comm and ucomm return a truncated name, so parse it from the command line field, # comm and ucomm return a truncated name, so parse it from the command line field,
# which means we have to trim off the arguments. # which means we have to trim off the arguments.
# Unfortunately, it doesn't seem to escape spaces - so we can't distinguish # Unfortunately, it doesn't seem to escape spaces - so we can't distinguish
# between the command name, and the first argument. Still, processes with spaces # between the command name, and the first argument. Still, processes with spaces
# in the name seem more common on OS X than on Linux, so prefer to parse out the # in the name seem more common on OS X than on Linux, so prefer to parse out the
# command line rather than using the stat data. # command line rather than using the stat data.
# If the command line is unavailable, you get the stat data in brackets - so # If the command line is unavailable, you get the stat data in brackets - so
# parse out brackets too. # parse out brackets too.
set ps_cmd 'ps -A -o command' set ps_cmd 'ps -A -o command'
# Erase everything after the first space # Erase everything after the first space
set sed_cmds $sed_cmds 's/ .*//' set sed_cmds $sed_cmds 's/ .*//'
# Erases weird stuff Linux gives like kworker/0:0 # Erases weird stuff Linux gives like kworker/0:0
set sed_cmds $sed_cmds 's|/[0-9]:[0-9]]$||g' set sed_cmds $sed_cmds 's|/[0-9]:[0-9]]$||g'
# Retain the last path component only # Retain the last path component only
set sed_cmds $sed_cmds 's|.*/||g' set sed_cmds $sed_cmds 's|.*/||g'
# Strip off square brackets. Cute, huh? # Strip off square brackets. Cute, huh?
set sed_cmds $sed_cmds 's/[][]//g' set sed_cmds $sed_cmds 's/[][]//g'
# Erase things that are just numbers # Erase things that are just numbers
set sed_cmds $sed_cmds 's/^[0-9]*$//' set sed_cmds $sed_cmds 's/^[0-9]*$//'
else else
# OS X, BSD. Preserve leading spaces. # OS X, BSD. Preserve leading spaces.
set ps_cmd 'ps axc -o comm' set ps_cmd 'ps axc -o comm'
# Delete parenthesized (zombie) processes # Delete parenthesized (zombie) processes
set sed_cmds $sed_cmds '/(.*)/d' set sed_cmds $sed_cmds '/(.*)/d'
end end
# Append sed command to delete first line (the header) # Append sed command to delete first line (the header)
set sed_cmds $sed_cmds '1d' set sed_cmds $sed_cmds '1d'
# Append sed commands to delete leading dashes and trailing spaces # Append sed commands to delete leading dashes and trailing spaces
# In principle, commands may have trailing spaces, but ps emits space padding on OS X # In principle, commands may have trailing spaces, but ps emits space padding on OS X
set sed_cmds $sed_cmds 's/^-//' 's/ *$//' set sed_cmds $sed_cmds 's/^-//' 's/ *$//'
# Run ps, pipe it through our massive set of sed commands, then sort and unique # Run ps, pipe it through our massive set of sed commands, then sort and unique
eval $ps_cmd | sed '-e '$sed_cmds | sort -u eval $ps_cmd | sed '-e '$sed_cmds | sort -u
end end

View file

@ -1,3 +1,3 @@
function __fish_complete_setxkbmap --description 'Complete setxkb options' --argument-names what function __fish_complete_setxkbmap --description 'Complete setxkb options' --argument-names what
sed -e "1,/! $what/d" -e '/^\s*$/,$d' /usr/share/X11/xkb/rules/xorg.lst | sed -r 's/\s+(\S+)\s+(.+)/\1\t\2/' sed -e "1,/! $what/d" -e '/^\s*$/,$d' /usr/share/X11/xkb/rules/xorg.lst | sed -r 's/\s+(\S+)\s+(.+)/\1\t\2/'
end end

View file

@ -1,15 +1,15 @@
function __fish_complete_ssh -d "common completions for ssh commands" --argument command function __fish_complete_ssh -d "common completions for ssh commands" --argument command
complete -c $command -s 1 --description "Protocol version 1 only" complete -c $command -s 1 --description "Protocol version 1 only"
complete -c $command -s 2 --description "Protocol version 2 only" complete -c $command -s 2 --description "Protocol version 2 only"
complete -c $command -s 4 --description "IPv4 addresses only" complete -c $command -s 4 --description "IPv4 addresses only"
complete -c $command -s 6 --description "IPv6 addresses only" complete -c $command -s 6 --description "IPv6 addresses only"
complete -c $command -s C --description "Compress all data" complete -c $command -s C --description "Compress all data"
complete -xc $command -s c --description "Encryption algorithm" -a "blowfish 3des des" complete -xc $command -s c --description "Encryption algorithm" -a "blowfish 3des des"
complete -r -c $command -s F --description "Configuration file" complete -r -c $command -s F --description "Configuration file"
complete -r -c $command -s i --description "Identity file" complete -r -c $command -s i --description "Identity file"
complete -x -c $command -s o --description "Options" -a " complete -x -c $command -s o --description "Options" -a "
AddressFamily AddressFamily
BatchMode BatchMode
BindAddress BindAddress
@ -56,6 +56,6 @@ function __fish_complete_ssh -d "common completions for ssh commands" --argument
UserKnownHostsFile UserKnownHostsFile
VerifyHostKeyDNS VerifyHostKeyDNS
" "
complete -c $command -s v --description "Verbose mode" complete -c $command -s v --description "Verbose mode"
end end

View file

@ -1,5 +1,5 @@
function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowing function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowing
set -l skip_next 1 set -l skip_next 1
set -l test set -l test
switch "$argv[1]" switch "$argv[1]"
case '--fcs-skip=*' case '--fcs-skip=*'
@ -8,38 +8,38 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowi
set -e argv[1] set -e argv[1]
end end
set -l res "" set -l res ""
set -l had_cmd 0 set -l had_cmd 0
set -l cmd (commandline -cop) (commandline -ct) set -l cmd (commandline -cop) (commandline -ct)
for i in $cmd for i in $cmd
if test $skip_next -gt 0 if test $skip_next -gt 0
set skip_next (math $skip_next - 1) set skip_next (math $skip_next - 1)
continue continue
end end
if test "$had_cmd" = 1 if test "$had_cmd" = 1
set res "$res $i" set res "$res $i"
else else
if contains -- $i $argv if contains -- $i $argv
set skip_next (math $skip_next + 1) set skip_next (math $skip_next + 1)
continue continue
end end
switch $i switch $i
case '-*' case '-*'
case '*=*' case '*=*'
case '*' case '*'
set had_cmd 1 set had_cmd 1
set res $i set res $i
end end
end end
end end
printf "%s\n" (complete -C$res) printf "%s\n" (complete -C$res)
end end

View file

@ -1,6 +1,6 @@
function __fish_complete_subcommand_root -d "Run the __fish_complete_subcommand function using a PATH containing /sbin and /usr/sbin" function __fish_complete_subcommand_root -d "Run the __fish_complete_subcommand function using a PATH containing /sbin and /usr/sbin"
set -lx PATH /sbin /usr/sbin $PATH ^/dev/null set -lx PATH /sbin /usr/sbin $PATH ^/dev/null
__fish_complete_subcommand $argv __fish_complete_subcommand $argv
end end

View file

@ -7,47 +7,47 @@
function __fish_complete_suffix -d "Complete using files" function __fish_complete_suffix -d "Complete using files"
# Variable declarations # Variable declarations
set -l comp set -l comp
set -l suff set -l suff
set -l desc set -l desc
set -l files set -l files
switch (count $argv) switch (count $argv)
case 1 case 1
set comp (commandline -ct) set comp (commandline -ct)
set suff $argv set suff $argv
set desc "" set desc ""
case 2 case 2
set comp $argv[1] set comp $argv[1]
set suff $argv[2] set suff $argv[2]
set desc "" set desc ""
case 3 case 3
set comp $argv[1] set comp $argv[1]
set suff $argv[2] set suff $argv[2]
set desc $argv[3] set desc $argv[3]
end end
# Perform the completion # Perform the completion
set base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//') set base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//')
eval "set files $base*$suff" eval "set files $base*$suff"
if test $files[1] if test $files[1]
printf "%s\t$desc\n" $files printf "%s\t$desc\n" $files
end end
# #
# Also do directory completion, since there might be files # Also do directory completion, since there might be files
# with the correct suffix in a subdirectory # with the correct suffix in a subdirectory
# No need to describe directories (#279) # No need to describe directories (#279)
# #
__fish_complete_directories $comp "" __fish_complete_directories $comp ""
end end

View file

@ -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

View file

@ -1,35 +1,35 @@
function __fish_complete_tar -d "Peek inside of archives and list all files" function __fish_complete_tar -d "Peek inside of archives and list all files"
set -l cmd (commandline -poc) set -l cmd (commandline -poc)
set -e cmd[1] set -e cmd[1]
for i in $cmd for i in $cmd
switch $i switch $i
case '-*' case '-*'
continue continue
case '*.tar.bz' '*.tar.bz2' '*.tbz' '*.tbz2' case '*.tar.bz' '*.tar.bz2' '*.tbz' '*.tbz2'
if test -f $i if test -f $i
set -l file_list (tar -jt <$i) set -l file_list (tar -jt <$i)
printf (_ "%s\tArchived file\n") $file_list printf (_ "%s\tArchived file\n") $file_list
end end
return return
case '*.tar.gz' '*.tgz' case '*.tar.gz' '*.tgz'
if test -f $i if test -f $i
set -l file_list (tar -it <$i) set -l file_list (tar -it <$i)
printf (_ "%s\tArchived file\n") $file_list printf (_ "%s\tArchived file\n") $file_list
end end
return return
case '*.tar' case '*.tar'
if test -f $i if test -f $i
set -l file_list (tar -t <$i) set -l file_list (tar -t <$i)
printf (_ "%s\tArchived file\n") $file_list printf (_ "%s\tArchived file\n") $file_list
end end
return return
end end
end end
end end

View file

@ -1,21 +1,21 @@
function __fish_complete_unrar -d "Peek inside of archives and list all files" function __fish_complete_unrar -d "Peek inside of archives and list all files"
set -l cmd (commandline -poc) set -l cmd (commandline -poc)
set -e cmd[1] set -e cmd[1]
for i in $cmd for i in $cmd
switch $i switch $i
case '-*' case '-*'
continue continue
case '*.rar' case '*.rar'
if test -f $i if test -f $i
set -l file_list (unrar vb $i) set -l file_list (unrar vb $i)
printf (_ "%s\tArchived file\n") $file_list printf (_ "%s\tArchived file\n") $file_list
end end
return return
end end
end end
end end

View file

@ -1,10 +1,10 @@
function __fish_complete_users --description "Print a list of local users, with the real user name as a description" function __fish_complete_users --description "Print a list of local users, with the real user name as a description"
if test -x /usr/bin/getent if test -x /usr/bin/getent
getent passwd | cut -d : -f 1,5 | string replace -r ':' \t getent passwd | cut -d : -f 1,5 | string replace -r ':' \t
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

View file

@ -1,29 +1,29 @@
function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --argument cfgfiles function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --argument cfgfiles
set -q cfgfiles[0] set -q cfgfiles[0]
or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc
# test if there is an alternative config file specified # test if there is an alternative config file specified
set -l store_next set -l store_next
for opt in (commandline -cpo) for opt in (commandline -cpo)
if set -q store_next[1] if set -q store_next[1]
set store_next set store_next
set cfgfiles $opt set cfgfiles $opt
continue continue
end
switch $opt
case -C --config
set store_next true
case '--config=*'
set cfgfiles (echo $opt | string replace '--config=' '')
end
end
for file in $cfgfiles
if test -f $file
string match -r '\[Dialer' < $file | string replace -r '\[Dialer (.+)\]' '$1'
end end
end | sort -u | string match -v Defaults
switch $opt
case -C --config
set store_next true
case '--config=*'
set cfgfiles (echo $opt | string replace '--config=' '')
end
end
for file in $cfgfiles
if test -f $file
string match -r '\[Dialer' <$file | string replace -r '\[Dialer (.+)\]' '$1'
end
end | sort -u | string match -v Defaults
end end

View file

@ -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

View file

@ -1,53 +1,53 @@
function __fish_contains_opt -d "Checks if a specific option has been given in the current commandline" function __fish_contains_opt -d "Checks if a specific option has been given in the current commandline"
set -l next_short set -l next_short
set -l short_opt set -l short_opt
set -l long_opt set -l long_opt
for i in $argv for i in $argv
if test $next_short if test $next_short
set next_short set next_short
set short_opt $short_opt $i set short_opt $short_opt $i
else else
switch $i switch $i
case -s case -s
set next_short 1 set next_short 1
case '-*' case '-*'
echo __fish_contains_opt: Unknown option $i echo __fish_contains_opt: Unknown option $i
return 1 return 1
case '**' case '**'
set long_opt $long_opt $i set long_opt $long_opt $i
end end
end end
end end
for i in $short_opt for i in $short_opt
if test -z $i if test -z $i
continue continue
end end
if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 0 return 0
end end
if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 0 return 0
end end
end end
for i in $long_opt for i in $long_opt
if test -z $i if test -z $i
continue continue
end end
if contains -- --$i (commandline -cpo) if contains -- --$i (commandline -cpo)
return 0 return 0
end end
end end
return 1 return 1
end end

View file

@ -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

View file

@ -1,11 +1,11 @@
function __fish_cursor_konsole -d 'Set cursor (konsole)' function __fish_cursor_konsole -d 'Set cursor (konsole)'
set -l shape $argv[1] set -l shape $argv[1]
switch "$shape" switch "$shape"
case block case block
echo -en '\e]50;CursorShape=0\x7' echo -en '\e]50;CursorShape=0\x7'
case underscore case underscore
echo -en '\e]50;CursorShape=2\x7' echo -en '\e]50;CursorShape=2\x7'
case line case line
echo -en '\e]50;CursorShape=1\x7' echo -en '\e]50;CursorShape=1\x7'
end end
end end

View file

@ -1,16 +1,16 @@
function __fish_cursor_xterm -d 'Set cursor (xterm)' function __fish_cursor_xterm -d 'Set cursor (xterm)'
set -l shape $argv[1] set -l shape $argv[1]
switch "$shape" switch "$shape"
case block case block
set shape 2 set shape 2
case underscore case underscore
set shape 4 set shape 4
case line case line
set shape 6 set shape 6
end end
if contains blink $argv if contains blink $argv
set shape (math $shape - 1) set shape (math $shape - 1)
end end
echo -en "\e[$shape q" echo -en "\e[$shape q"
end end

View file

@ -3,7 +3,7 @@
# #
function __fish_describe_command -d "Command used to find descriptions for commands" function __fish_describe_command -d "Command used to find descriptions for commands"
apropos $argv ^/dev/null | awk -v FS=" +- +" '{ apropos $argv ^/dev/null | awk -v FS=" +- +" '{
split($1, names, ", "); split($1, names, ", ");
for (name in names) for (name in names)
if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) { if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) {

View file

@ -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

View file

@ -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

View file

@ -1,52 +1,52 @@
function __fish_gnu_complete -d "Wrapper for the complete built-in. Skips the long completions on non-GNU systems" function __fish_gnu_complete -d "Wrapper for the complete built-in. Skips the long completions on non-GNU systems"
set is_gnu 0 set is_gnu 0
set -l argv_out set -l argv_out
# Check if we are using a gnu system # Check if we are using a gnu system
for i in $argv for i in $argv
switch $i switch $i
case -g --is-gnu case -g --is-gnu
set is_gnu 1 set is_gnu 1
case '*' case '*'
set argv_out $argv_out $i set argv_out $argv_out $i
end end
end end
set argv $argv_out set argv $argv_out
set argv_out set argv_out
set -l skip_next 0 set -l skip_next 0
# Remove long option if not on a gnu system # Remove long option if not on a gnu system
switch $is_gnu switch $is_gnu
case 0 case 0
for i in $argv for i in $argv
switch $skip_next switch $skip_next
case 1 case 1
set skip_next 0 set skip_next 0
continue continue
end end
switch $i switch $i
case -l --long case -l --long
set skip_next 1 set skip_next 1
continue continue
end end
set argv_out $argv_out $i set argv_out $argv_out $i
end end
set argv $argv_out set argv $argv_out
end end
complete $argv complete $argv
end end

View file

@ -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

View file

@ -1,15 +1,16 @@
function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet' function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
set cmd (commandline -poc) set cmd (commandline -poc)
set -e cmd[1] set -e cmd[1]
for i in $cmd for i in $cmd
switch $i switch $i
case '-*' case '-*'
case '*' case '*'
return 1; return 1
end
end end
return 0 end
return 0
end end

View file

@ -1,5 +1,5 @@
function __fish_is_token_n --description 'Test if current token is on Nth place' --argument n function __fish_is_token_n --description 'Test if current token is on Nth place' --argument n
# Add a fake element to increment without calling math # Add a fake element to increment without calling math
set -l num (count (commandline -poc) additionalelement) set -l num (count (commandline -poc) additionalelement)
test $n -eq $num test $n -eq $num
end end

View file

@ -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)
@ -24,7 +25,7 @@ function __fish_make_completion_signals --description 'Make list of kill signals
set -g __kill_signals set -g __kill_signals
kill -L | sed -e 's/^ //; s/ */ /g; y/ /\n/' | while read -l signo kill -L | sed -e 's/^ //; s/ */ /g; y/ /\n/' | while read -l signo
test -z "$signo" test -z "$signo"
and break # the sed above produces one blank line at the end and break # the sed above produces one blank line at the end
read -l signame read -l signame
set -g __kill_signals $__kill_signals "$signo $signame" set -g __kill_signals $__kill_signals "$signo $signame"
end end

View file

@ -1,4 +1,4 @@
function __fish_man_page function __fish_man_page
man (basename (commandline -po; echo)[1]) ^/dev/null man (basename (commandline -po; echo)[1]) ^/dev/null
or printf \a or printf \a
end end

View file

@ -1,27 +1,27 @@
function __fish_move_last -d "Move the last element of a directory history from src to dest" function __fish_move_last -d "Move the last element of a directory history from src to dest"
set -l src $argv[1] set -l src $argv[1]
set -l dest $argv[2] set -l dest $argv[2]
set -l size_src (count $$src) set -l size_src (count $$src)
if test $size_src = 0 if test $size_src = 0
# Cannot make this step # Cannot make this step
printf (_ "Hit end of history…\n") printf (_ "Hit end of history…\n")
return 1 return 1
end end
# Append current dir to the end of the destination # Append current dir to the end of the destination
set -g (echo $dest) $$dest (command pwd) set -g (echo $dest) $$dest (command pwd)
set ssrc $$src set ssrc $$src
# Change dir to the last entry in the source dir-hist # Change dir to the last entry in the source dir-hist
builtin cd $ssrc[$size_src] builtin cd $ssrc[$size_src]
# Keep all but the last from the source dir-hist # Keep all but the last from the source dir-hist
set -e (echo $src)\[$size_src] set -e (echo $src)\[$size_src]
# All ok, return success # All ok, return success
return 0 return 0
end end

View file

@ -1,15 +1,15 @@
function __fish_no_arguments -d "Internal fish function" function __fish_no_arguments -d "Internal fish function"
set -l cmd (commandline -poc) (commandline -tc) set -l cmd (commandline -poc) (commandline -tc)
set -e cmd[1] set -e cmd[1]
for i in $cmd for i in $cmd
switch $i switch $i
case '-*' case '-*'
case '*' case '*'
return 1 return 1
end end
end end
return 0 return 0
end end

View file

@ -1,51 +1,51 @@
function __fish_not_contain_opt -d "Checks that a specific option is not in the current command line" function __fish_not_contain_opt -d "Checks that a specific option is not in the current command line"
set -l next_short set -l next_short
set -l short_opt set -l short_opt
set -l long_opt set -l long_opt
for i in $argv for i in $argv
if test $next_short if test $next_short
set next_short set next_short
set short_opt $short_opt $i set short_opt $short_opt $i
else else
switch $i switch $i
case -s case -s
set next_short 1 set next_short 1
case '-*' case '-*'
echo __fish_contains_opt: Unknown option $i echo __fish_contains_opt: Unknown option $i
return 1 return 1
case '**' case '**'
set long_opt $long_opt $i set long_opt $long_opt $i
end end
end end
end end
for i in $short_opt for i in $short_opt
if test -z $i if test -z $i
continue continue
end end
if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 1 return 1
end end
if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
return 1 return 1
end end
end end
for i in $long_opt for i in $long_opt
if test -z $i if test -z $i
continue continue
end end
if contains -- --$i (commandline -cpo) if contains -- --$i (commandline -cpo)
return 1 return 1
end end
end end
return 0 return 0
end end

View file

@ -1,13 +1,13 @@
function __fish_paginate -d "Paginate the current command using the users default pager" function __fish_paginate -d "Paginate the current command using the users default pager"
set -l cmd less set -l cmd less
if set -q PAGER if set -q PAGER
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
end end

View file

@ -1,5 +1,5 @@
# a function to print a list of ports local collections # a function to print a list of ports local collections
function __fish_ports_dirs -d 'Obtain a list of ports local collections' function __fish_ports_dirs -d 'Obtain a list of ports local collections'
ls /usr/ports ls /usr/ports
end end

View file

@ -1,4 +1,4 @@
function __fish_print_abook_emails --description 'Print email addresses (abook)' function __fish_print_abook_emails --description 'Print email addresses (abook)'
abook --mutt-query "" | string match -r -v '^\s*$' abook --mutt-query "" | string match -r -v '^\s*$'
end end

View file

@ -1,11 +1,11 @@
function __fish_print_addresses --description "Print a list of known network addresses" function __fish_print_addresses --description "Print a list of known network addresses"
if command -s ip >/dev/null if command -s ip >/dev/null
command ip --oneline address | cut -d" " -f7 | sed "s:\(.*\)/.*:\1:" command ip --oneline address | cut -d" " -f7 | sed "s:\(.*\)/.*:\1:"
else if command -s ifconfig >/dev/null else if command -s ifconfig >/dev/null
# This is for OSX/BSD # This is for OSX/BSD
# There's also linux ifconfig but that has at least two different output formats # There's also linux ifconfig but that has at least two different output formats
# is basically dead, and ip is installed on everything now # is basically dead, and ip is installed on everything now
ifconfig | awk '/^\tinet/ { print $2 } ' ifconfig | awk '/^\tinet/ { print $2 } '
end end
end end

View file

@ -1,4 +1,4 @@
function __fish_print_arch_daemons --description 'Print arch daemons' function __fish_print_arch_daemons --description 'Print arch daemons'
find /etc/rc.d/ -executable -type f -printf '%f\n' find /etc/rc.d/ -executable -type f -printf '%f\n'
end end

View file

@ -1,6 +1,6 @@
function __fish_print_debian_apache_confs function __fish_print_debian_apache_confs
# Helper script for completions for a2enconf/a2disconf # Helper script for completions for a2enconf/a2disconf
for conf in /etc/apache2/conf-available/*.conf for conf in /etc/apache2/conf-available/*.conf
basename "$conf" .conf basename "$conf" .conf
end end
end end

View file

@ -1,6 +1,6 @@
function __fish_print_debian_apache_mods function __fish_print_debian_apache_mods
# Helper script for completions for a2enmod/a2dismod # Helper script for completions for a2enmod/a2dismod
for mod in /etc/apache2/mods-available/*.load for mod in /etc/apache2/mods-available/*.load
basename "$mod" .load basename "$mod" .load
end end
end end

View file

@ -1,6 +1,6 @@
function __fish_print_debian_apache_sites function __fish_print_debian_apache_sites
# Helper script for completions for a2ensite/a2dissite # Helper script for completions for a2ensite/a2dissite
for site in /etc/apache2/sites-available/* for site in /etc/apache2/sites-available/*
basename "$site" .conf basename "$site" .conf
end end
end end

View file

@ -1,7 +1,7 @@
function __fish_print_debian_services --description 'Prints services installed' function __fish_print_debian_services --description 'Prints services installed'
for service in /etc/init.d/* for service in /etc/init.d/*
if [ -x $service ] if [ -x $service ]
basename $service basename $service
end
end end
end
end end

View file

@ -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

View file

@ -1,9 +1,9 @@
function __fish_print_filesystems -d "Print a list of all known filesystem types" function __fish_print_filesystems -d "Print a list of all known filesystem types"
set -l fs adfs affs autofs coda coherent cramfs devpts efs ext ext2 ext3 set -l fs adfs affs autofs coda coherent cramfs devpts efs ext ext2 ext3
set fs $fs hfs hpfs iso9660 jfs minix msdos ncpfs nfs ntfs proc qnx4 ramfs set fs $fs hfs hpfs iso9660 jfs minix msdos ncpfs nfs ntfs proc qnx4 ramfs
set fs $fs reiserfs romfs smbfs sysv tmpfs udf ufs umsdos vfat xenix xfs xiafs set fs $fs reiserfs romfs smbfs sysv tmpfs udf ufs umsdos vfat xenix xfs xiafs
# Mount has helper binaries to mount filesystems # Mount has helper binaries to mount filesystems
# These are called mount.* and are placed somewhere in $PATH # These are called mount.* and are placed somewhere in $PATH
printf "%s\n" $fs (string replace -ra ".*/mount." "" -- $PATH/mount.*) printf "%s\n" $fs (string replace -ra ".*/mount." "" -- $PATH/mount.*)
end end

View file

@ -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

View file

@ -1,41 +1,39 @@
function __fish_print_hostnames -d "Print a list of known hostnames" function __fish_print_hostnames -d "Print a list of known hostnames"
# HACK: This only deals with ipv4 # HACK: This only deals with ipv4
# 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
# Ignore zero ips and getent hosts >/dev/null 2>&1 # test if 'getent hosts' works and redirect output so errors don't print
getent hosts | string match -r -v '^0.0.0.0' \ # Ignore zero ips
| string replace -r '[0-9.]*\s*' '' | string split " " getent hosts | string match -r -v '^0.0.0.0' | 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
if test -r /etc/fstab
# Print nfs servers from /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 ':.*' ''
if test -r /etc/fstab end
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 # 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"
# Check hosts known to ssh for file in /etc/ssh/ssh_config ~/.ssh/config
set -l known_hosts ~/.ssh/known_hosts{,2} /etc/ssh/known_hosts{,2} # Yes, seriously - the default specifies both with and without "2" if test -r $file
for file in /etc/ssh/ssh_config ~/.ssh/config # Print hosts from system wide ssh configuration file
if test -r $file # Note the non-capturing group to avoid printing "name"
# Print hosts from system wide ssh configuration file 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 ' '
# Note the non-capturing group to avoid printing "name" set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \
string match -ri '\s*Host(?:name)?(?:\s+|\s*=\s*)\w.*' < $file | string replace -ri '^\s*Host(?:name)?\s*(\S+)' '$1' \ | string replace -ri '.*KnownHostsFile\s*' '')
| string replace -r '\s+' ' ' | string split ' ' end
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \ end
| string replace -ri '.*KnownHostsFile\s*' '') for file in $known_hosts
end # Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200)
end test -r $file
for file in $known_hosts and string replace -ra '(\S+) .*' '$1' <$file | string match -r '^[^#|[=]+$' | string split ","
# Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200) end
test -r $file; and string replace -ra '(\S+) .*' '$1' < $file | string match -r '^[^#|[=]+$' | string split "," return 0
end
return 0
end end

View file

@ -1,10 +1,10 @@
function __fish_print_interfaces --description "Print a list of known network interfaces" function __fish_print_interfaces --description "Print a list of known network interfaces"
if test -d /sys/class/net if test -d /sys/class/net
cd /sys/class/net cd /sys/class/net
for i in * for i in *
echo $i echo $i
end end
else # OSX/BSD else # OSX/BSD
command ifconfig -l | string split ' ' command ifconfig -l | string split ' '
end end
end end

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,4 @@
function __fish_print_lsblk_columns --description 'Print available lsblk columns' function __fish_print_lsblk_columns --description 'Print available lsblk columns'
lsblk --help | sed '1,/Available columns:/d; /^$/,$d; s/^\s\+//; s/\s/\t/' lsblk --help | sed '1,/Available columns:/d; /^$/,$d; s/^\s\+//; s/\s/\t/'
end end

View file

@ -1,15 +1,15 @@
function __fish_print_make_targets function __fish_print_make_targets
# Some seds (e.g. on Mac OS X), don't support \n in the RHS # Some seds (e.g. on Mac OS X), don't support \n in the RHS
# Use a literal newline instead # Use a literal newline instead
# http://sed.sourceforge.net/sedfaq4.html#s4.1 # http://sed.sourceforge.net/sedfaq4.html#s4.1
# The 'rev | cut | rev' trick removes everything after the last colon # The 'rev | cut | rev' trick removes everything after the last colon
for file in GNUmakefile Makefile makefile for file in GNUmakefile Makefile makefile
if test -f $file if test -f $file
__fish_sgrep -h -o -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $file ^/dev/null | rev | cut -d ":" -f 2- | rev | sed -e 's/^ *//;s/ *$//;s/ */\\ __fish_sgrep -h -o -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $file ^/dev/null | rev | cut -d ":" -f 2- | rev | sed -e 's/^ *//;s/ *$//;s/ */\\
/g' ^/dev/null /g' ^/dev/null
# On case insensitive filesystems, Makefile and makefile are the same; stop now so we don't double-print # On case insensitive filesystems, Makefile and makefile are the same; stop now so we don't double-print
break break
end end
end end
end end

View file

@ -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

View file

@ -1,13 +1,12 @@
function __fish_print_mounted --description 'Print mounted devices' function __fish_print_mounted --description 'Print mounted devices'
if test -r /etc/mtab if test -r /etc/mtab
# In mtab, spaces are replaced by a literal '\040' # In mtab, spaces are replaced by a literal '\040'
# So it's safe to get the second "field" and then replace it # So it's safe to get the second "field" and then replace it
# \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

View file

@ -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

View file

@ -1,139 +1,139 @@
function __fish_print_packages function __fish_print_packages
# apt-cache is much, much faster than rpm, and can do this in real # apt-cache is much, much faster than rpm, and can do this in real
# time. We use it if available. # time. We use it if available.
switch (commandline -tc) switch (commandline -tc)
case '-**' case '-**'
return return
end end
#Get the word 'Package' in the current language #Get the word 'Package' in the current language
set -l package (_ Package) set -l package (_ Package)
# Set up cache directory # Set up cache directory
if test -z "$XDG_CACHE_HOME" if test -z "$XDG_CACHE_HOME"
set XDG_CACHE_HOME $HOME/.cache set XDG_CACHE_HOME $HOME/.cache
end end
mkdir -m 700 -p $XDG_CACHE_HOME mkdir -m 700 -p $XDG_CACHE_HOME
if type -q -f apt-cache if type -q -f apt-cache
# Do not generate the cache as apparently sometimes this is slow. # Do not generate the cache as apparently sometimes this is slow.
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547550 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547550
apt-cache --no-generate pkgnames (commandline -tc) ^/dev/null | sed -e 's/$/'\t$package'/' apt-cache --no-generate pkgnames (commandline -tc) ^/dev/null | sed -e 's/$/'\t$package'/'
return return
end end
# Pkg is fast on FreeBSD and provides versioning info which we want for # Pkg is fast on FreeBSD and provides versioning info which we want for
# installed packages # installed packages
if begin if begin
type -q -f pkg type -q -f pkg
and test (uname) = "FreeBSD" and test (uname) = "FreeBSD"
end end
pkg query "%n-%v" pkg query "%n-%v"
return return
end end
# Caches for 5 minutes # Caches for 5 minutes
if type -q -f pacman if type -q -f pacman
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
if test -f $cache_file if test -f $cache_file
cat $cache_file cat $cache_file
set age (math (date +%s) - (stat -c '%Y' $cache_file)) set age (math (date +%s) - (stat -c '%Y' $cache_file))
set max_age 250 set max_age 250
if test $age -lt $max_age if test $age -lt $max_age
return return
end end
end end
# prints: <package name> Package # prints: <package name> Package
pacman -Ssq | sed -e 's/$/\t'$package'/' >$cache_file & pacman -Ssq | sed -e 's/$/\t'$package'/' >$cache_file &
return return
end end
# Zypper needs caching as it is slow # Zypper needs caching as it is slow
if type -q -f zypper if type -q -f zypper
# Use libzypp cache file if available # Use libzypp cache file if available
if test -f /var/cache/zypp/solv/@System/solv.idx if test -f /var/cache/zypp/solv/@System/solv.idx
cat /var/cache/zypp/solv/*/solv.idx | awk '!/application:|srcpackage:|product:|pattern:|patch:/ {print $1'\t$package'}' cat /var/cache/zypp/solv/*/solv.idx | awk '!/application:|srcpackage:|product:|pattern:|patch:/ {print $1'\t$package'}'
return return
end end
# If the cache is less than five minutes old, we do not recalculate it # If the cache is less than five minutes old, we do not recalculate it
set -l cache_file $XDG_CACHE_HOME/.zypper-cache.$USER set -l cache_file $XDG_CACHE_HOME/.zypper-cache.$USER
if test -f $cache_file if test -f $cache_file
cat $cache_file cat $cache_file
set -l age (math (date +%s) - (stat -c '%Y' $cache_file)) set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
set -l max_age 300 set -l max_age 300
if test $age -lt $max_age if test $age -lt $max_age
return return
end end
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
# yum is slow, just like rpm, so go to the background # yum is slow, just like rpm, so go to the background
if type -q -f /usr/share/yum-cli/completion-helper.py if type -q -f /usr/share/yum-cli/completion-helper.py
# If the cache is less than six hours old, we do not recalculate it # If the cache is less than six hours old, we do not recalculate it
set cache_file $XDG_CACHE_HOME/.yum-cache.$USER set cache_file $XDG_CACHE_HOME/.yum-cache.$USER
if test -f $cache_file if test -f $cache_file
cat $cache_file cat $cache_file
set age (math (date +%s) - (stat -c '%Y' $cache_file)) set age (math (date +%s) - (stat -c '%Y' $cache_file))
set max_age 21600 set max_age 21600
if test $age -lt $max_age if test $age -lt $max_age
return return
end end
end end
# Remove package version information from output and pipe into cache file # Remove package version information from output and pipe into cache file
/usr/share/yum-cli/completion-helper.py list all -d 0 -C | sed "s/\..*/\t$package/" >$cache_file & /usr/share/yum-cli/completion-helper.py list all -d 0 -C | sed "s/\..*/\t$package/" >$cache_file &
return return
end end
# Rpm is too slow for this job, so we set it up to do completions # Rpm is too slow for this job, so we set it up to do completions
# as a background job and cache the results. # as a background job and cache the results.
if type -q -f rpm if type -q -f rpm
# If the cache is less than five minutes old, we do not recalculate it # If the cache is less than five minutes old, we do not recalculate it
set cache_file $XDG_CACHE_HOME/.rpm-cache.$USER set cache_file $XDG_CACHE_HOME/.rpm-cache.$USER
if test -f $cache_file if test -f $cache_file
cat $cache_file cat $cache_file
set age (math (date +%s) - (stat -c '%Y' $cache_file)) set age (math (date +%s) - (stat -c '%Y' $cache_file))
set max_age 250 set max_age 250
if test $age -lt $max_age if test $age -lt $max_age
return return
end end
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
# This completes the package name from the portage tree. # This completes the package name from the portage tree.
# True for installing new packages. Function for printing # True for installing new packages. Function for printing
# installed on the system packages is in completions/emerge.fish # installed on the system packages is in completions/emerge.fish
# eix is MUCH faster than emerge so use it if it is available # eix is MUCH faster than emerge so use it if it is available
if type -q -f eix if type -q -f eix
eix --only-names "^"(commandline -tc) | cut -d/ -f2 eix --only-names "^"(commandline -tc) | cut -d/ -f2
return return
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
end end

View file

@ -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

View file

@ -1,13 +1,13 @@
function __fish_print_service_names -d 'All services known to the system' function __fish_print_service_names -d 'All services known to the system'
if test -d /run/systemd/system # Systemd systems if test -d /run/systemd/system # Systemd systems
# For the `service` command, this needs to be without the type suffix # For the `service` command, this needs to be without the type suffix
# on Debian at least # on Debian at least
__fish_systemctl_services | string replace -r '.service$' '' __fish_systemctl_services | string replace -r '.service$' ''
else if type -f rc-service ^/dev/null # OpenRC (Gentoo) else if type -f rc-service ^/dev/null # OpenRC (Gentoo)
command rc-service -l command rc-service -l
else if test -d /etc/init.d # SysV on Debian and other linuxen else if test -d /etc/init.d # SysV on Debian and other linuxen
string replace '/etc/init.d/' '' -- /etc/init.d/* string replace '/etc/init.d/' '' -- /etc/init.d/*
else # Freebsd else # Freebsd
command service -l command service -l
end end
end end

View file

@ -1,3 +1,3 @@
function __fish_print_svn_rev --description 'Print svn revisions' function __fish_print_svn_rev --description 'Print svn revisions'
printf '%s' (svnversion | sed 's=[^0-9:]*==g') printf '%s' (svnversion | sed 's=[^0-9:]*==g')
end end

View file

@ -1,11 +1,11 @@
function __fish_print_users --description "Print a list of local users" function __fish_print_users --description "Print a list of local users"
if test -x /usr/bin/getent if test -x /usr/bin/getent
getent passwd | cut -d : -f 1 getent passwd | cut -d : -f 1
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

View file

@ -1,4 +1,4 @@
function __fish_print_xdg_mimeapps --description 'Print xdg mime applications' function __fish_print_xdg_mimeapps --description 'Print xdg mime applications'
find ~/.local/share/applications/ /usr/share/applications/ -name \*.desktop \( -type f -or -type l \) -printf '%P\n' | sort -u find ~/.local/share/applications/ /usr/share/applications/ -name \*.desktop \( -type f -or -type l \) -printf '%P\n' | sort -u
end end

View file

@ -1,5 +1,5 @@
function __fish_print_xdg_mimetypes --description 'Print XDG mime types' function __fish_print_xdg_mimetypes --description 'Print XDG mime types'
cat ~/.local/share/applications/mimeinfo.cache | grep -v "\[MIME Cache\]" | tr = \t cat ~/.local/share/applications/mimeinfo.cache | grep -v "\[MIME Cache\]" | tr = \t
cat /usr/share/applications/mimeinfo.cache | grep -v "\[MIME Cache\]" | tr = \t cat /usr/share/applications/mimeinfo.cache | grep -v "\[MIME Cache\]" | tr = \t
end end

View file

@ -1,13 +1,13 @@
function __fish_print_xrandr_modes --description 'Print xrandr modes' function __fish_print_xrandr_modes --description 'Print xrandr modes'
set -l out set -l out
xrandr | sed '/^Screen/d; s/^ \+/mode: /' | while read -l output mode misc xrandr | sed '/^Screen/d; s/^ \+/mode: /' | while read -l output mode misc
switch $output switch $output
case mode: case mode:
echo $mode\t(echo $misc | sed 's/\(^ \+\)\|\( *$\)//') [$out] echo $mode\t(echo $misc | sed 's/\(^ \+\)\|\( *$\)//') [$out]
case '*' case '*'
set out $output set out $output
end end
end end
end end

View file

@ -1,5 +1,5 @@
function __fish_print_xrandr_outputs --description 'Print xrandr outputs' function __fish_print_xrandr_outputs --description 'Print xrandr outputs'
xrandr | sed '/^Screen\|^ /d; s/^\(\S\+\) \+\(.\+\)/\1\t\2/' xrandr | sed '/^Screen\|^ /d; s/^\(\S\+\) \+\(.\+\)/\1\t\2/'
end end

View file

@ -1,4 +1,4 @@
function __fish_print_xwindows --description 'Print X windows' function __fish_print_xwindows --description 'Print X windows'
xwininfo -root -children | grep '^\s\+0x' | sed '/(has no name)/d; s/^\s*\(\S\+\)\s\+"\(.\+\)":\s\+(\(.*\)).*$/\1\t\2 (\3)/' xwininfo -root -children | grep '^\s\+0x' | sed '/(has no name)/d; s/^\s*\(\S\+\)\s\+"\(.\+\)":\s\+(\(.*\)).*$/\1\t\2 (\3)/'
end end

View file

@ -1,11 +1,11 @@
# A function to verify if prt-get (the crux package management tool) needs to be completed by a further command # A function to verify if prt-get (the crux package management tool) needs to be completed by a further command
function __fish_prt_no_subcommand -d 'Test if prt-get has yet to be given the command' function __fish_prt_no_subcommand -d 'Test if prt-get has yet to be given the command'
for i in (commandline -opc) for i in (commandline -opc)
if contains -- $i install depinst grpinst update remove sysup lock unlock listlocked diff quickdiff search dsearch fsearch info path readme depends quickdep dependent deptree dup list printf listinst listorphans isinst current ls cat edit help dumpconfig version cache if contains -- $i install depinst grpinst update remove sysup lock unlock listlocked diff quickdiff search dsearch fsearch info path readme depends quickdep dependent deptree dup list printf listinst listorphans isinst current ls cat edit help dumpconfig version cache
return 1 return 1
end end
end end
return 0 return 0
end end

View file

@ -1,4 +1,4 @@
# a function to obtain a list of installed packages with prt-get # a function to obtain a list of installed packages with prt-get
function __fish_prt_packages -d 'Obtain a list of installed packages' function __fish_prt_packages -d 'Obtain a list of installed packages'
prt-get listinst prt-get listinst
end end

View file

@ -1,5 +1,5 @@
# a function to obtain a list of ports with prt-get # a function to obtain a list of ports with prt-get
function __fish_prt_ports -d 'Obtain a list of ports' function __fish_prt_ports -d 'Obtain a list of ports'
prt-get list prt-get list
end end

View file

@ -1,9 +1,9 @@
# a function to verify if prt-get should have packages as potential completion # a function to verify if prt-get should have packages as potential completion
function __fish_prt_use_package -d 'Test if prt-get should have packages as potential completion' function __fish_prt_use_package -d 'Test if prt-get should have packages as potential completion'
for i in (commandline -opc) for i in (commandline -opc)
if contains -- $i update remove lock unlock current if contains -- $i update remove lock unlock current
return 0 return 0
end end
end end
return 1 return 1
end end

View file

@ -1,9 +1,9 @@
# a function to test if prt-get should have ports as potential completions # a function to test if prt-get should have ports as potential completions
function __fish_prt_use_port -d 'Test if prt-get should have ports as potential completion' function __fish_prt_use_port -d 'Test if prt-get should have ports as potential completion'
for i in (commandline -opc) for i in (commandline -opc)
if contains -- $i install depinst grpinst diff depends quickdep dependent deptree isinst info path readme ls cat edit if contains -- $i install depinst grpinst diff depends quickdep dependent deptree isinst info path readme ls cat edit
return 0 return 0
end end
end end
return 1 return 1
end end

View file

@ -1,10 +1,10 @@
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
end end

View file

@ -1,5 +1,5 @@
function __fish_sgrep -d "Call grep without honoring GREP_OPTIONS settings" function __fish_sgrep -d "Call grep without honoring GREP_OPTIONS settings"
set -l GREP_OPTIONS set -l GREP_OPTIONS
command grep $argv command grep $argv
end end

View file

@ -10,7 +10,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
end end
bind $argv \cy yank bind $argv \cy yank
or return # protect against invalid $argv or return # protect against invalid $argv
bind $argv \ey yank-pop bind $argv \ey yank-pop
# Left/Right arrow # Left/Right arrow

View file

@ -68,80 +68,82 @@ set -g __fish_svn_prompt_char_token_broken_color --bold magenta
# ============================== # ==============================
function __fish_svn_prompt_parse_status --argument flag_status_string --description "helper function that does pretty formatting on svn status" function __fish_svn_prompt_parse_status --argument flag_status_string --description "helper function that does pretty formatting on svn status"
# SVN status symbols # SVN status symbols
# Do not change these! These are the expected characters that are output from `svn status`, they are taken from `svn help status` # Do not change these! These are the expected characters that are output from `svn status`, they are taken from `svn help status`
set -l __fish_svn_prompt_chars A C D I M R X \? ! ~ L + S K O T B set -l __fish_svn_prompt_chars A C D I M R X \? ! ~ L + S K O T B
# this sets up an array of all the types of status codes that could be returned. # this sets up an array of all the types of status codes that could be returned.
set -l __fish_svn_prompt_flag_names added conflicted deleted ignored modified replaced unversioned_external unversioned missing locked scheduled switched token_present token_other token_stolen token_broken set -l __fish_svn_prompt_flag_names added conflicted deleted ignored modified replaced unversioned_external unversioned missing locked scheduled switched token_present token_other token_stolen token_broken
# iterate over the different status types # iterate over the different status types
for flag_type in $__fish_svn_prompt_flag_names for flag_type in $__fish_svn_prompt_flag_names
# resolve the name of the variable for the character representing the current status type # resolve the name of the variable for the character representing the current status type
set -l flag_index (contains -i $flag_type $__fish_svn_prompt_flag_names) set -l flag_index (contains -i $flag_type $__fish_svn_prompt_flag_names)
# check to see if the status string for this column contains the character representing the current status type # check to see if the status string for this column contains the character representing the current status type
if test (echo $flag_status_string | grep -c $__fish_svn_prompt_chars[$flag_index]) -eq 1 if test (echo $flag_status_string | grep -c $__fish_svn_prompt_chars[$flag_index]) -eq 1
# if it does, then get the names of the variables for the display character and colour to format it with # if it does, then get the names of the variables for the display character and colour to format it with
set -l flag_var_display __fish_svn_prompt_char_{$flag_type}_display set -l flag_var_display __fish_svn_prompt_char_{$flag_type}_display
set -l flag_var_color __fish_svn_prompt_char_{$flag_type}_color set -l flag_var_color __fish_svn_prompt_char_{$flag_type}_color
# set the colour and print display character, then restore to default display colour # set the colour and print display character, then restore to default display colour
printf '%s%s%s' (set_color $$flag_var_color) $$flag_var_display (set_color normal) printf '%s%s%s' (set_color $$flag_var_color) $$flag_var_display (set_color normal)
end end
end end
end 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
end
# get the current revision number return
printf '(%s%s%s' (set_color $__fish_svn_prompt_color_revision) (__fish_print_svn_rev) (set_color normal) end
# resolve the status of the checkout # get the current revision number
# 1. perform `svn status` printf '(%s%s%s' (set_color $__fish_svn_prompt_color_revision) (__fish_print_svn_rev) (set_color normal)
# 2. remove extra lines that aren't necessary
# 3. cut the output down to the first 7 columns, as these contain the information needed
set -l svn_status_lines (command svn status | sed -e 's=^Summary of conflicts.*==' -e 's=^ Text conflicts.*==' -e 's=^ Property conflicts.*==' -e 's=^ Tree conflicts.*==' -e 's=.*incoming .* upon update.*==' | cut -c 1-7)
# track the last column to contain a status flag # resolve the status of the checkout
set -l last_column 0 # 1. perform `svn status`
# 2. remove extra lines that aren't necessary
# 3. cut the output down to the first 7 columns, as these contain the information needed
set -l svn_status_lines (command svn status | sed -e 's=^Summary of conflicts.*==' -e 's=^ Text conflicts.*==' -e 's=^ Property conflicts.*==' -e 's=^ Tree conflicts.*==' -e 's=.*incoming .* upon update.*==' | cut -c 1-7)
# iterate over the 7 columns of output (the 7 columns are defined on `svn help status`) # track the last column to contain a status flag
for col in (seq 7) set -l last_column 0
# get the output for a particular column
# 1. echo the whole status flag text
# 2. cut out the current column of characters
# 3. remove spaces and newline characters
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) # iterate over the 7 columns of output (the 7 columns are defined on `svn help status`)
if [ (count $column_status) -ne 0 ]; for col in (seq 7)
# we only want to display unique status flags (eg: if there are 5 modified files, the prompt should only show the modified status once) # get the output for a particular column
set -l column_unique_status (echo $column_status | sort | uniq) # 1. echo the whole status flag text
# parse the status flags for this column and create the formatting by calling out to the helper function # 2. cut out the current column of characters
set -l svn_status_flags (__fish_svn_prompt_parse_status $column_unique_status) # 3. remove spaces and newline characters
set -l column_status (printf '%s\n' $svn_status_lines | cut -c $col | tr -d ' \n')
# the default separator is empty # check that the character count is not zero (this would indicate that there are status flags in this column)
set -l prompt_separator "" if [ (count $column_status) -ne 0 ]
for index in (seq (math "$col - $last_column"))
# the prompt separator variable has to be updated with the number of separators needed to represent empty status columns (eg: if a file has the status "A +" then it should display as "A|||+" in the prompt)
set prompt_separator $prompt_separator$__fish_svn_prompt_char_separator
end
# record that the current column was the last one printed to the prompt # 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 last_column $col set -l column_unique_status (echo $column_status | sort | uniq)
# print the separator string then the current column's status flags # parse the status flags for this column and create the formatting by calling out to the helper function
printf '%s%s' $prompt_separator $svn_status_flags set -l svn_status_flags (__fish_svn_prompt_parse_status $column_unique_status)
end
end
# print the close of the svn status prompt # the default separator is empty
printf ')' set -l prompt_separator ""
for index in (seq (math "$col - $last_column"))
# the prompt separator variable has to be updated with the number of separators needed to represent empty status columns (eg: if a file has the status "A +" then it should display as "A|||+" in the prompt)
set prompt_separator $prompt_separator$__fish_svn_prompt_char_separator
end
# record that the current column was the last one printed to the prompt
set last_column $col
# print the separator string then the current column's status flags
printf '%s%s' $prompt_separator $svn_status_flags
end
end
# print the close of the svn status prompt
printf ')'
end end

View file

@ -1,9 +1,9 @@
function __fish_systemctl_automounts function __fish_systemctl_automounts
if type -q systemctl if type -q systemctl
if __fish_contains_opt user if __fish_contains_opt user
systemctl --user list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' ' systemctl --user list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
else else
systemctl list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' ' systemctl list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
end end
end end
end end

View file

@ -1,11 +1,11 @@
function __fish_systemctl_devices function __fish_systemctl_devices
if type -q systemctl if type -q systemctl
if __fish_contains_opt user if __fish_contains_opt user
# Devices are usually generated at runtime # Devices are usually generated at runtime
# Therefore show known _units_, not unit-files # Therefore show known _units_, not unit-files
systemctl --user list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' ' systemctl --user list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
else else
systemctl list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' ' systemctl list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
end end
end end
end end

View file

@ -1,9 +1,9 @@
function __fish_systemctl_mounts function __fish_systemctl_mounts
if type -q systemctl if type -q systemctl
if __fish_contains_opt user if __fish_contains_opt user
systemctl --user list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' ' systemctl --user list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' '
else else
systemctl list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' ' systemctl list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' '
end end
end end
end end

View file

@ -1,11 +1,11 @@
function __fish_systemctl_scopes function __fish_systemctl_scopes
if type -q systemctl if type -q systemctl
if __fish_contains_opt user if __fish_contains_opt user
# Scopes are usually generated at runtime # Scopes are usually generated at runtime
# Therefore show known _units_, not unit-files # Therefore show known _units_, not unit-files
systemctl --user list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' ' systemctl --user list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
else else
systemctl list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' ' systemctl list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
end end
end end
end end

View file

@ -1,9 +1,9 @@
function __fish_systemctl_service_paths function __fish_systemctl_service_paths
if type -q systemctl if type -q systemctl
if __fish_contains_opt user if __fish_contains_opt user
systemctl --user list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' ' systemctl --user list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' '
else else
systemctl list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' ' systemctl list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' '
end end
end end
end end

View file

@ -1,13 +1,13 @@
function __fish_systemctl_services function __fish_systemctl_services
if type -q systemctl if type -q systemctl
if __fish_contains_opt user if __fish_contains_opt user
systemctl --user list-unit-files --no-legend --type=service ^/dev/null $argv | cut -f 1 -d ' ' systemctl --user list-unit-files --no-legend --type=service ^/dev/null $argv | cut -f 1 -d ' '
systemctl --user list-units --state=loaded --no-legend --type=service ^/dev/null | cut -f 1 -d ' ' systemctl --user list-units --state=loaded --no-legend --type=service ^/dev/null | cut -f 1 -d ' '
else else
# list-unit-files will also show disabled units # list-unit-files will also show disabled units
systemctl list-unit-files --no-legend --type=service ^/dev/null $argv | cut -f 1 -d ' ' systemctl list-unit-files --no-legend --type=service ^/dev/null $argv | cut -f 1 -d ' '
# list-units will not show disabled units but will show instances (like wpa_supplicant@wlan0.service) # list-units will not show disabled units but will show instances (like wpa_supplicant@wlan0.service)
systemctl list-units --state=loaded --no-legend --type=service ^/dev/null | cut -f 1 -d ' ' systemctl list-units --state=loaded --no-legend --type=service ^/dev/null | cut -f 1 -d ' '
end end
end end
end end

View file

@ -1,11 +1,11 @@
function __fish_systemctl_slices function __fish_systemctl_slices
if type -q systemctl if type -q systemctl
if __fish_contains_opt user if __fish_contains_opt user
# Slices are usually generated at runtime # Slices are usually generated at runtime
# Therefore show known _units_, not unit-files # Therefore show known _units_, not unit-files
systemctl --user list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' ' systemctl --user list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
else else
systemctl list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' ' systemctl list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
end end
end end
end end

Some files were not shown because too many files have changed in this diff Show more