mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
reformat all fish scripts
I hate doing this but I am tired of touching a fish script as part of some change and having `make style` radically change it. Which makes editing fish scripts more painful than it needs to be. It is time to do a wholesale reformatting of these scripts to conform to the documented style as implemented by the `fish_indent` program.
This commit is contained in:
parent
54a76bb9e5
commit
11a60c8374
161 changed files with 2638 additions and 2587 deletions
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
function N_ --description "No-op"
|
||||
printf "%s" $argv
|
||||
printf "%s" $argv
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function __fish_append -d "Internal completion function for appending string to the commandline" --argument separator
|
||||
set -e argv[1]
|
||||
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/")
|
||||
set -e argv[1]
|
||||
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/")
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -5,21 +5,21 @@ function __fish_bind_test1
|
|||
for i in (commandline -poc)
|
||||
switch $i
|
||||
case -k --k --ke --key
|
||||
set use_keys yes
|
||||
set use_keys yes
|
||||
|
||||
case "-*"
|
||||
|
||||
case "*"
|
||||
set args $args $i
|
||||
set args $args $i
|
||||
end
|
||||
end
|
||||
|
||||
switch $use_keys
|
||||
case yes
|
||||
switch (count $args)
|
||||
case 1
|
||||
return 0
|
||||
end
|
||||
switch (count $args)
|
||||
case 1
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
function __fish_bind_test2
|
||||
set -l args
|
||||
for i in (commandline -poc)
|
||||
switch $i
|
||||
case "-*"
|
||||
set -l args
|
||||
for i in (commandline -poc)
|
||||
switch $i
|
||||
case "-*"
|
||||
|
||||
case "*"
|
||||
set args $args $i
|
||||
end
|
||||
end
|
||||
case "*"
|
||||
set args $args $i
|
||||
end
|
||||
end
|
||||
|
||||
switch (count $args)
|
||||
case 2
|
||||
return 0
|
||||
end
|
||||
switch (count $args)
|
||||
case 2
|
||||
return 0
|
||||
end
|
||||
|
||||
return 1
|
||||
return 1
|
||||
|
||||
end
|
||||
|
|
|
@ -5,10 +5,10 @@ function __fish_commandline_test
|
|||
for i in (commandline -poc)
|
||||
switch $i
|
||||
case -f --f --fu --fun --func --funct --functi --functio --function
|
||||
set is_function yes
|
||||
set is_function yes
|
||||
|
||||
case --
|
||||
break
|
||||
break
|
||||
|
||||
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ function __fish_commandline_test
|
|||
|
||||
switch $is_function
|
||||
case yes
|
||||
return 0
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ function __fish_complete_abook_formats --description 'Complete abook formats'
|
|||
set -l pat
|
||||
switch $argv[1]
|
||||
case in
|
||||
set pat '/output:/,$d; /input:\|^$/d'
|
||||
set pat '/output:/,$d; /input:\|^$/d'
|
||||
case out
|
||||
set pat '/input:/,/output:/d; /^$/d'
|
||||
set pat '/input:/,/output:/d; /^$/d'
|
||||
case '*'
|
||||
return 1
|
||||
return 1
|
||||
end
|
||||
abook --formats | sed -e $pat -e 's/^\s\+//'
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
function __fish_complete_ant_targets -d "Print list of targets from build.xml and imported files"
|
||||
set -l buildfile "build.xml"
|
||||
if test -f $buildfile
|
||||
# show ant targets
|
||||
__fish_filter_ant_targets $buildfile
|
||||
set -l buildfile "build.xml"
|
||||
if test -f $buildfile
|
||||
# show ant targets
|
||||
__fish_filter_ant_targets $buildfile
|
||||
|
||||
# find files with buildfile
|
||||
set files (sed -n "s/^.*<import[^>]* file=[\"']\([^\"']*\)[\"'].*\$/\1/p" < $buildfile)
|
||||
# find files with buildfile
|
||||
set files (sed -n "s/^.*<import[^>]* file=[\"']\([^\"']*\)[\"'].*\$/\1/p" < $buildfile)
|
||||
|
||||
# iterate through files and display their targets
|
||||
for file in $files;
|
||||
__fish_filter_ant_targets $file
|
||||
end
|
||||
end
|
||||
# iterate through files and display their targets
|
||||
for file in $files
|
||||
|
||||
__fish_filter_ant_targets $file
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
function __fish_complete_atool_archive_contents --description 'List archive contents'
|
||||
set -l cmd (commandline -cop)
|
||||
set -e cmd[1]
|
||||
set -l file
|
||||
for arg in $cmd
|
||||
switch $arg
|
||||
case '-*'
|
||||
case '*'
|
||||
if test -f $arg
|
||||
set file $arg
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not set -q file[1]
|
||||
return
|
||||
end
|
||||
als $file -qq | sed -r 's/^\s*[0-9]+\s+[0-9-]+\s+[0-9:]+\s+(.*)$/\1/'
|
||||
set -l cmd (commandline -cop)
|
||||
set -e cmd[1]
|
||||
set -l file
|
||||
for arg in $cmd
|
||||
switch $arg
|
||||
case '-*'
|
||||
case '*'
|
||||
if test -f $arg
|
||||
set file $arg
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not set -q file[1]
|
||||
return
|
||||
end
|
||||
als $file -qq | sed -r 's/^\s*[0-9]+\s+[0-9-]+\s+[0-9:]+\s+(.*)$/\1/'
|
||||
|
||||
end
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
# Bittorrent commands
|
||||
|
||||
function __fish_complete_bittorrent
|
||||
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 download_slice_size -x --description "Bytes per request"
|
||||
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 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 maxport --description "Maximum port to listen to"
|
||||
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 saveas -r --description "Local file target"
|
||||
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 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 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 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 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_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 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 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 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 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 download_slice_size -x --description "Bytes per request"
|
||||
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 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 maxport --description "Maximum port to listen to"
|
||||
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 saveas -r --description "Local file target"
|
||||
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 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 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 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 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_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 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 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 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"
|
||||
end
|
||||
|
|
|
@ -1,32 +1,36 @@
|
|||
function __fish_complete_cd -d "Completions for the cd command"
|
||||
set -l token (commandline -ct)
|
||||
# Absolute path or explicitly from the current directory - no descriptions and no CDPATH
|
||||
if string match -qr '^\.?\.?/.*' -- $token
|
||||
for d in $token*/
|
||||
# Check if it's accessible - the glob only matches directories
|
||||
[ -x $d ]; and printf "%s\n" $d
|
||||
end
|
||||
else # Relative path - check $CDPATH and use that as description
|
||||
set -l cdpath $CDPATH
|
||||
[ -z "$cdpath" ]; and set cdpath "."
|
||||
# Remove the real path to "." (i.e. $PWD) from cdpath if we're in it
|
||||
# so it doesn't get printed in the descriptions
|
||||
if set -l ind (contains -i -- $PWD $cdpath)
|
||||
and contains -- "." $cdpath
|
||||
set -e cdpath[$ind]
|
||||
end
|
||||
# TODO: There's a subtlety regarding descriptions - if $cdpath[1]/foo and $cdpath[2]/foo exist, we print both
|
||||
# but want the first description to win - this currently works, but is not guaranteed
|
||||
for i in $cdpath
|
||||
set -l desc
|
||||
# Don't show description for current directory
|
||||
# and replace $HOME with "~"
|
||||
[ $i = "." ]; or set -l desc (string replace -r -- "^$HOME" "~" "$i")
|
||||
# This assumes the CDPATH component itself is cd-able
|
||||
for d in $i/$token*/
|
||||
# Remove the cdpath component again
|
||||
[ -x $d ]; and printf "%s\t%s\n" (string replace -r "^$i/" "" -- $d) $desc
|
||||
end
|
||||
end
|
||||
end
|
||||
set -l token (commandline -ct)
|
||||
# Absolute path or explicitly from the current directory - no descriptions and no CDPATH
|
||||
if string match -qr '^\.?\.?/.*' -- $token
|
||||
for d in $token*/
|
||||
# Check if it's accessible - the glob only matches directories
|
||||
[ -x $d ]
|
||||
and printf "%s\n" $d
|
||||
end
|
||||
else # Relative path - check $CDPATH and use that as description
|
||||
set -l cdpath $CDPATH
|
||||
[ -z "$cdpath" ]
|
||||
and set cdpath "."
|
||||
# Remove the real path to "." (i.e. $PWD) from cdpath if we're in it
|
||||
# so it doesn't get printed in the descriptions
|
||||
if set -l ind (contains -i -- $PWD $cdpath)
|
||||
and contains -- "." $cdpath
|
||||
set -e cdpath[$ind]
|
||||
end
|
||||
# TODO: There's a subtlety regarding descriptions - if $cdpath[1]/foo and $cdpath[2]/foo exist, we print both
|
||||
# but want the first description to win - this currently works, but is not guaranteed
|
||||
for i in $cdpath
|
||||
set -l desc
|
||||
# Don't show description for current directory
|
||||
# and replace $HOME with "~"
|
||||
[ $i = "." ]
|
||||
or set -l desc (string replace -r -- "^$HOME" "~" "$i")
|
||||
# This assumes the CDPATH component itself is cd-able
|
||||
for d in $i/$token*/
|
||||
# Remove the cdpath component again
|
||||
[ -x $d ]
|
||||
and printf "%s\t%s\n" (string replace -r "^$i/" "" -- $d) $desc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
function __fish_complete_command --description 'Complete using all available commands'
|
||||
set -l ctoken (commandline -ct)
|
||||
switch $ctoken
|
||||
case '*=*'
|
||||
set ctoken (string split "=" -- $ctoken)
|
||||
printf '%s\n' $ctoken[1]=(complete -C$ctoken[2])
|
||||
case '*'
|
||||
complete -C$ctoken
|
||||
end
|
||||
set -l ctoken (commandline -ct)
|
||||
switch $ctoken
|
||||
case '*=*'
|
||||
set ctoken (string split "=" -- $ctoken)
|
||||
printf '%s\n' $ctoken[1]=(complete -C$ctoken[2])
|
||||
case '*'
|
||||
complete -C$ctoken
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
function __fish_complete_convert_options --description 'Complete Convert options' --argument what
|
||||
switch $what
|
||||
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/'
|
||||
case color Color
|
||||
convert -list color | awk '{ print $1"\t"$2" "$3} ' | sed '1,/----/d'
|
||||
case family
|
||||
convert -list Font | grep family | sed 's/^\s*.\+: //' | sort -u
|
||||
case font Font
|
||||
convert -list Font | grep Font | sed 's/^\s*.\+: //' | sort -u
|
||||
case '*'
|
||||
convert -list $what
|
||||
end
|
||||
switch $what
|
||||
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/'
|
||||
case color Color
|
||||
convert -list color | awk '{ print $1"\t"$2" "$3} ' | sed '1,/----/d'
|
||||
case family
|
||||
convert -list Font | grep family | sed 's/^\s*.\+: //' | sort -u
|
||||
case font Font
|
||||
convert -list Font | grep Font | sed 's/^\s*.\+: //' | sort -u
|
||||
case '*'
|
||||
convert -list $what
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
|
||||
function __fish_complete_directories -d "Complete using directories" --argument comp
|
||||
|
||||
set desc (_ Directory)
|
||||
set desc (_ Directory)
|
||||
|
||||
if test (count $argv) -gt 1
|
||||
set desc $argv[2]
|
||||
end
|
||||
if test (count $argv) -gt 1
|
||||
set desc $argv[2]
|
||||
end
|
||||
|
||||
eval "set dirs "$comp"*/"
|
||||
eval "set dirs "$comp"*/"
|
||||
|
||||
if test $dirs[1]
|
||||
printf "%s\t$desc\n" $dirs
|
||||
end
|
||||
if test $dirs[1]
|
||||
printf "%s\t$desc\n" $dirs
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
function __fish_complete_file_url
|
||||
set -l comp
|
||||
set -l comp
|
||||
|
||||
if set -q argv[1]
|
||||
set comp $argv[1]
|
||||
else
|
||||
set comp (commandline -ct)
|
||||
end
|
||||
if set -q argv[1]
|
||||
set comp $argv[1]
|
||||
else
|
||||
set comp (commandline -ct)
|
||||
end
|
||||
|
||||
set -l prefix (echo $comp|cut -c 1-7)
|
||||
set -l prefix (echo $comp|cut -c 1-7)
|
||||
|
||||
if test file:// = $prefix
|
||||
set -l stripped (echo $comp|cut -c 8-)
|
||||
printf "%s\n" file://(complete -C"echo $stripped")
|
||||
else
|
||||
echo file://
|
||||
end
|
||||
if test file:// = $prefix
|
||||
set -l stripped (echo $comp|cut -c 8-)
|
||||
printf "%s\n" file://(complete -C"echo $stripped")
|
||||
else
|
||||
echo file://
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
function __fish_complete_ftp -d 'Complete ftp, pftp' --argument-names ftp
|
||||
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 6 -d 'Use IPv6 only'
|
||||
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 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 e -d 'Disable command editing and history support'
|
||||
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 v -d 'Verbose. Show all server responses and data transfer stats'
|
||||
complete -c $ftp -s d -d 'Enable debugging'
|
||||
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 6 -d 'Use IPv6 only'
|
||||
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 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 e -d 'Disable command editing and history support'
|
||||
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 v -d 'Verbose. Show all server responses and data transfer stats'
|
||||
complete -c $ftp -s d -d 'Enable debugging'
|
||||
end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
function __fish_complete_groups --description "Print a list of local groups, with group members as the description"
|
||||
if command -s getent >/dev/null
|
||||
getent group | cut -d ':' -f 1,4 | sed 's/:/\t/'
|
||||
else
|
||||
cut -d ':' -f 1,4 /etc/group | sed 's/:/\t/'
|
||||
end
|
||||
if command -s getent >/dev/null
|
||||
getent group | cut -d ':' -f 1,4 | sed 's/:/\t/'
|
||||
else
|
||||
cut -d ':' -f 1,4 /etc/group | sed 's/:/\t/'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
function __fish_complete_list --argument div cmd prefix iprefix
|
||||
if not set -q cmd[1]
|
||||
echo "Usage:
|
||||
if not set -q cmd[1]
|
||||
echo "Usage:
|
||||
__fish_complete_list <separator> <function> <prefix> <itemprefix>
|
||||
where:
|
||||
separator - a symbol, separating individual entries
|
||||
function - a function which prints a completion list to complete each entry
|
||||
prefix - a prefix, which is printed before the list
|
||||
itemprefix - a prefix, which is printed before each item" > /dev/stderr
|
||||
return 1
|
||||
end
|
||||
set -q iprefix[1]
|
||||
or set -l iprefix ""
|
||||
set -q prefix[1]
|
||||
or set -l prefix ""
|
||||
set -l pat (commandline -t)
|
||||
#set -l pat $argv[5]
|
||||
switch $pat
|
||||
case "*$div*"
|
||||
for i in (echo $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
|
||||
echo $i
|
||||
end
|
||||
case '*'
|
||||
for i in $prefix$iprefix(eval $cmd)
|
||||
echo $i
|
||||
end
|
||||
end
|
||||
itemprefix - a prefix, which is printed before each item" >/dev/stderr
|
||||
return 1
|
||||
end
|
||||
set -q iprefix[1]
|
||||
or set -l iprefix ""
|
||||
set -q prefix[1]
|
||||
or set -l prefix ""
|
||||
set -l pat (commandline -t)
|
||||
#set -l pat $argv[5]
|
||||
switch $pat
|
||||
case "*$div*"
|
||||
for i in (echo $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
|
||||
echo $i
|
||||
end
|
||||
case '*'
|
||||
for i in $prefix$iprefix(eval $cmd)
|
||||
echo $i
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -4,35 +4,35 @@ function __fish_complete_lpr -d 'Complete lpr common options' --argument-names c
|
|||
|
||||
switch $cmd
|
||||
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
|
||||
|
||||
switch $cmd
|
||||
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
|
||||
|
||||
switch $cmd
|
||||
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)'
|
||||
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)'
|
||||
end
|
||||
|
||||
switch $cmd
|
||||
case lp lpr
|
||||
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 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 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 page-ranges= -d 'Page ranges'
|
||||
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 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 '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 '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 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 page-ranges= -d 'Page ranges'
|
||||
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 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 '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 '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'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
function __fish_complete_lpr_option --description 'Complete lpr option'
|
||||
set -l optstr (commandline -t)
|
||||
switch $optstr
|
||||
case '*=*'
|
||||
set -l IFS =
|
||||
echo $optstr | read -l opt val
|
||||
set -l descr
|
||||
for l in (lpoptions -l ^/dev/null | string match -- "*$opt*" | string replace -r '.*/(.*):\s*(.*)$' '$1 $2' | string split " ")
|
||||
if not set -q descr[1]
|
||||
set descr $l
|
||||
continue
|
||||
end
|
||||
set -l default ''
|
||||
if string match -q '\**' -- $l
|
||||
set default 'Default '
|
||||
set l (string sub -s 2 -- $l)
|
||||
end
|
||||
echo $opt=$l\t$default$descr
|
||||
end
|
||||
case '*'
|
||||
lpoptions -l ^/dev/null | string replace -r '(.*)/(.*):.*$' '$1=\t$2'
|
||||
end
|
||||
set -l optstr (commandline -t)
|
||||
switch $optstr
|
||||
case '*=*'
|
||||
set -l IFS =
|
||||
echo $optstr | read -l opt val
|
||||
set -l descr
|
||||
for l in (lpoptions -l ^/dev/null | string match -- "*$opt*" | string replace -r '.*/(.*):\s*(.*)$' '$1 $2' | string split " ")
|
||||
if not set -q descr[1]
|
||||
set descr $l
|
||||
continue
|
||||
end
|
||||
set -l default ''
|
||||
if string match -q '\**' -- $l
|
||||
set default 'Default '
|
||||
set l (string sub -s 2 -- $l)
|
||||
end
|
||||
echo $opt=$l\t$default$descr
|
||||
end
|
||||
case '*'
|
||||
lpoptions -l ^/dev/null | string replace -r '(.*)/(.*):.*$' '$1=\t$2'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function __fish_complete_lsusb
|
||||
lsusb | awk '{print $2 ":" $4}'| cut -c1-7
|
||||
lsusb | awk '{print $2 ":" $4}' | cut -c1-7
|
||||
end
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
function __fish_complete_man
|
||||
# Try to guess what section to search in. If we don't know, we
|
||||
# use [^)]*, which should match any section
|
||||
# Try to guess what section to search in. If we don't know, we
|
||||
# use [^)]*, which should match any section
|
||||
|
||||
set section ""
|
||||
set prev (commandline -poc)
|
||||
set -e prev[1]
|
||||
while set -q prev[1]
|
||||
switch $prev[1]
|
||||
case '-**'
|
||||
set section ""
|
||||
set prev (commandline -poc)
|
||||
set -e prev[1]
|
||||
while set -q prev[1]
|
||||
switch $prev[1]
|
||||
case '-**'
|
||||
|
||||
case '*'
|
||||
set section $prev[1]
|
||||
end
|
||||
set -e prev[1]
|
||||
end
|
||||
case '*'
|
||||
set section $prev[1]
|
||||
end
|
||||
set -e prev[1]
|
||||
end
|
||||
|
||||
set section $section"[^)]*"
|
||||
|
||||
|
@ -25,9 +25,9 @@ function __fish_complete_man
|
|||
set token "."
|
||||
end
|
||||
|
||||
if test -n "$token"
|
||||
# Do the actual search
|
||||
apropos $token ^/dev/null | awk '
|
||||
if test -n "$token"
|
||||
# Do the actual search
|
||||
apropos $token ^/dev/null | awk '
|
||||
BEGIN { FS="[\t ]- "; OFS="\t"; }
|
||||
# BSD/Darwin
|
||||
/^[^( \t]+\('$section'\)/ {
|
||||
|
@ -66,7 +66,7 @@ function __fish_complete_man
|
|||
'
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
function __fish_complete_path --description "Complete using path"
|
||||
set -l target
|
||||
set -l description
|
||||
switch (count $argv)
|
||||
case 0
|
||||
# pass
|
||||
case 1
|
||||
set target "$argv[1]"
|
||||
case 2 "*"
|
||||
set target "$argv[1]"
|
||||
set description "$argv[2]"
|
||||
end
|
||||
printf "%s\t$description\n" (command ls -dp "$target"*)
|
||||
set -l target
|
||||
set -l description
|
||||
switch (count $argv)
|
||||
case 0
|
||||
# pass
|
||||
case 1
|
||||
set target "$argv[1]"
|
||||
case 2 "*"
|
||||
set target "$argv[1]"
|
||||
set description "$argv[2]"
|
||||
end
|
||||
printf "%s\t$description\n" (command ls -dp "$target"*)
|
||||
end
|
||||
|
|
|
@ -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 -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 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 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 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 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 x -d ' Only match processes whose name (or command line if -f is specified) exactly match the pattern'
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
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
|
||||
# 'tail -n +2' deletes the first line, which contains the headers
|
||||
# %self is removed from output by string match -r -v
|
||||
set -l SELF %self
|
||||
|
||||
# Display the tty if available
|
||||
# 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 ' *\[\?*\] *$' ''
|
||||
# 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
|
||||
# %self is removed from output by string match -r -v
|
||||
set -l SELF %self
|
||||
|
||||
# Display the tty if available
|
||||
# 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 ' *\[\?*\] *$' ''
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
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
|
||||
set -l ps_cmd
|
||||
set -l sed_cmds
|
||||
if test (uname) = Linux
|
||||
# comm and ucomm return a truncated name, so parse it from the command line field,
|
||||
# which means we have to trim off the arguments.
|
||||
# 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
|
||||
# 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.
|
||||
# If the command line is unavailable, you get the stat data in brackets - so
|
||||
# parse out brackets too.
|
||||
set ps_cmd 'ps -A -o command'
|
||||
|
||||
# Erase everything after the first space
|
||||
set sed_cmds $sed_cmds 's/ .*//'
|
||||
|
||||
# Erases weird stuff Linux gives like kworker/0:0
|
||||
set sed_cmds $sed_cmds 's|/[0-9]:[0-9]]$||g'
|
||||
|
||||
# Retain the last path component only
|
||||
set sed_cmds $sed_cmds 's|.*/||g'
|
||||
|
||||
# Strip off square brackets. Cute, huh?
|
||||
set sed_cmds $sed_cmds 's/[][]//g'
|
||||
|
||||
# Erase things that are just numbers
|
||||
set sed_cmds $sed_cmds 's/^[0-9]*$//'
|
||||
else
|
||||
# OS X, BSD. Preserve leading spaces.
|
||||
set ps_cmd 'ps axc -o comm'
|
||||
|
||||
# Delete parenthesized (zombie) processes
|
||||
set sed_cmds $sed_cmds '/(.*)/d'
|
||||
end
|
||||
|
||||
# Append sed command to delete first line (the header)
|
||||
set sed_cmds $sed_cmds '1d'
|
||||
|
||||
# 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
|
||||
set sed_cmds $sed_cmds 's/^-//' 's/ *$//'
|
||||
|
||||
# Run ps, pipe it through our massive set of sed commands, then sort and unique
|
||||
eval $ps_cmd | sed '-e '$sed_cmds | sort -u
|
||||
# Our function runs ps, followed by a massive list of commands passed to sed
|
||||
set -l ps_cmd
|
||||
set -l sed_cmds
|
||||
if test (uname) = Linux
|
||||
# comm and ucomm return a truncated name, so parse it from the command line field,
|
||||
# which means we have to trim off the arguments.
|
||||
# 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
|
||||
# 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.
|
||||
# If the command line is unavailable, you get the stat data in brackets - so
|
||||
# parse out brackets too.
|
||||
set ps_cmd 'ps -A -o command'
|
||||
|
||||
# Erase everything after the first space
|
||||
set sed_cmds $sed_cmds 's/ .*//'
|
||||
|
||||
# Erases weird stuff Linux gives like kworker/0:0
|
||||
set sed_cmds $sed_cmds 's|/[0-9]:[0-9]]$||g'
|
||||
|
||||
# Retain the last path component only
|
||||
set sed_cmds $sed_cmds 's|.*/||g'
|
||||
|
||||
# Strip off square brackets. Cute, huh?
|
||||
set sed_cmds $sed_cmds 's/[][]//g'
|
||||
|
||||
# Erase things that are just numbers
|
||||
set sed_cmds $sed_cmds 's/^[0-9]*$//'
|
||||
else
|
||||
# OS X, BSD. Preserve leading spaces.
|
||||
set ps_cmd 'ps axc -o comm'
|
||||
|
||||
# Delete parenthesized (zombie) processes
|
||||
set sed_cmds $sed_cmds '/(.*)/d'
|
||||
end
|
||||
|
||||
# Append sed command to delete first line (the header)
|
||||
set sed_cmds $sed_cmds '1d'
|
||||
|
||||
# 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
|
||||
set sed_cmds $sed_cmds 's/^-//' 's/ *$//'
|
||||
|
||||
# Run ps, pipe it through our massive set of sed commands, then sort and unique
|
||||
eval $ps_cmd | sed '-e '$sed_cmds | sort -u
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
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 2 --description "Protocol version 2 only"
|
||||
complete -c $command -s 4 --description "IPv4 addresses only"
|
||||
complete -c $command -s 6 --description "IPv6 addresses only"
|
||||
complete -c $command -s C --description "Compress all data"
|
||||
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 i --description "Identity file"
|
||||
complete -x -c $command -s o --description "Options" -a "
|
||||
complete -c $command -s 1 --description "Protocol version 1 only"
|
||||
complete -c $command -s 2 --description "Protocol version 2 only"
|
||||
complete -c $command -s 4 --description "IPv4 addresses only"
|
||||
complete -c $command -s 6 --description "IPv6 addresses only"
|
||||
complete -c $command -s C --description "Compress all data"
|
||||
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 i --description "Identity file"
|
||||
complete -x -c $command -s o --description "Options" -a "
|
||||
AddressFamily
|
||||
BatchMode
|
||||
BindAddress
|
||||
|
@ -56,6 +56,6 @@ function __fish_complete_ssh -d "common completions for ssh commands" --argument
|
|||
UserKnownHostsFile
|
||||
VerifyHostKeyDNS
|
||||
"
|
||||
complete -c $command -s v --description "Verbose mode"
|
||||
complete -c $command -s v --description "Verbose mode"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowing
|
||||
set -l skip_next 1
|
||||
function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowing
|
||||
set -l skip_next 1
|
||||
set -l test
|
||||
switch "$argv[1]"
|
||||
case '--fcs-skip=*'
|
||||
|
@ -8,38 +8,38 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowi
|
|||
set -e argv[1]
|
||||
end
|
||||
|
||||
set -l res ""
|
||||
set -l had_cmd 0
|
||||
set -l cmd (commandline -cop) (commandline -ct)
|
||||
set -l res ""
|
||||
set -l had_cmd 0
|
||||
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)
|
||||
continue
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
if test "$had_cmd" = 1
|
||||
set res "$res $i"
|
||||
else
|
||||
if test "$had_cmd" = 1
|
||||
set res "$res $i"
|
||||
else
|
||||
|
||||
if contains -- $i $argv
|
||||
set skip_next (math $skip_next + 1)
|
||||
continue
|
||||
end
|
||||
if contains -- $i $argv
|
||||
set skip_next (math $skip_next + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
switch $i
|
||||
case '-*'
|
||||
case '*=*'
|
||||
case '*'
|
||||
switch $i
|
||||
case '-*'
|
||||
case '*=*'
|
||||
case '*'
|
||||
|
||||
set had_cmd 1
|
||||
set res $i
|
||||
end
|
||||
end
|
||||
end
|
||||
set had_cmd 1
|
||||
set res $i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
printf "%s\n" (complete -C$res)
|
||||
printf "%s\n" (complete -C$res)
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
|
||||
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
|
||||
__fish_complete_subcommand $argv
|
||||
set -lx PATH /sbin /usr/sbin $PATH ^/dev/null
|
||||
__fish_complete_subcommand $argv
|
||||
end
|
||||
|
|
|
@ -7,47 +7,47 @@
|
|||
|
||||
function __fish_complete_suffix -d "Complete using files"
|
||||
|
||||
# Variable declarations
|
||||
# Variable declarations
|
||||
|
||||
set -l comp
|
||||
set -l suff
|
||||
set -l desc
|
||||
set -l files
|
||||
set -l comp
|
||||
set -l suff
|
||||
set -l desc
|
||||
set -l files
|
||||
|
||||
switch (count $argv)
|
||||
switch (count $argv)
|
||||
|
||||
case 1
|
||||
set comp (commandline -ct)
|
||||
set suff $argv
|
||||
set desc ""
|
||||
case 1
|
||||
set comp (commandline -ct)
|
||||
set suff $argv
|
||||
set desc ""
|
||||
|
||||
case 2
|
||||
set comp $argv[1]
|
||||
set suff $argv[2]
|
||||
set desc ""
|
||||
case 2
|
||||
set comp $argv[1]
|
||||
set suff $argv[2]
|
||||
set desc ""
|
||||
|
||||
case 3
|
||||
set comp $argv[1]
|
||||
set suff $argv[2]
|
||||
set desc $argv[3]
|
||||
case 3
|
||||
set comp $argv[1]
|
||||
set suff $argv[2]
|
||||
set desc $argv[3]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# Perform the completion
|
||||
# Perform the completion
|
||||
|
||||
set base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//')
|
||||
eval "set files $base*$suff"
|
||||
set base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//')
|
||||
eval "set files $base*$suff"
|
||||
|
||||
if test $files[1]
|
||||
printf "%s\t$desc\n" $files
|
||||
end
|
||||
if test $files[1]
|
||||
printf "%s\t$desc\n" $files
|
||||
end
|
||||
|
||||
#
|
||||
# Also do directory completion, since there might be files
|
||||
# with the correct suffix in a subdirectory
|
||||
# No need to describe directories (#279)
|
||||
#
|
||||
#
|
||||
# Also do directory completion, since there might be files
|
||||
# with the correct suffix in a subdirectory
|
||||
# No need to describe directories (#279)
|
||||
#
|
||||
|
||||
__fish_complete_directories $comp ""
|
||||
__fish_complete_directories $comp ""
|
||||
|
||||
end
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
function __fish_complete_svn_diff --description 'Complete "svn diff" arguments'
|
||||
set -l cmdl (commandline -cop)
|
||||
#set -l cmdl svn diff --diff-cmd diff --extensions '-a -b'
|
||||
set -l diff diff
|
||||
set -l args
|
||||
while set -q cmdl[1]
|
||||
switch $cmdl[1]
|
||||
case --diff-cmd
|
||||
if set -q cmdl[2]
|
||||
set diff $cmdl[2]
|
||||
set -e cmd[2]
|
||||
end
|
||||
set -l cmdl (commandline -cop)
|
||||
#set -l cmdl svn diff --diff-cmd diff --extensions '-a -b'
|
||||
set -l diff diff
|
||||
set -l args
|
||||
while set -q cmdl[1]
|
||||
switch $cmdl[1]
|
||||
case --diff-cmd
|
||||
if set -q cmdl[2]
|
||||
set diff $cmdl[2]
|
||||
set -e cmd[2]
|
||||
end
|
||||
|
||||
case --extensions
|
||||
if set -q cmdl[2]
|
||||
set args $cmdl[2]
|
||||
set -e cmdl[2]
|
||||
end
|
||||
end
|
||||
set -e cmdl[1]
|
||||
end
|
||||
set -l token (commandline -cpt)
|
||||
complete -C"$diff $args $token"
|
||||
case --extensions
|
||||
if set -q cmdl[2]
|
||||
set args $cmdl[2]
|
||||
set -e cmdl[2]
|
||||
end
|
||||
end
|
||||
set -e cmdl[1]
|
||||
end
|
||||
set -l token (commandline -cpt)
|
||||
complete -C"$diff $args $token"
|
||||
|
||||
end
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
|
||||
function __fish_complete_tar -d "Peek inside of archives and list all files"
|
||||
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
|
||||
case '*.tar.bz' '*.tar.bz2' '*.tbz' '*.tbz2'
|
||||
if test -f $i
|
||||
set -l file_list (tar -jt <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
case '*.tar.bz' '*.tar.bz2' '*.tbz' '*.tbz2'
|
||||
if test -f $i
|
||||
set -l file_list (tar -jt <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
|
||||
case '*.tar.gz' '*.tgz'
|
||||
if test -f $i
|
||||
set -l file_list (tar -it <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
case '*.tar.gz' '*.tgz'
|
||||
if test -f $i
|
||||
set -l file_list (tar -it <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
|
||||
case '*.tar'
|
||||
if test -f $i
|
||||
set -l file_list (tar -t <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
case '*.tar'
|
||||
if test -f $i
|
||||
set -l file_list (tar -t <$i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
|
||||
function __fish_complete_unrar -d "Peek inside of archives and list all files"
|
||||
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
|
||||
case '*.rar'
|
||||
if test -f $i
|
||||
set -l file_list (unrar vb $i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
case '*.rar'
|
||||
if test -f $i
|
||||
set -l file_list (unrar vb $i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
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
|
||||
getent passwd | cut -d : -f 1,5 | string replace -r ':' \t
|
||||
else if test -x /usr/bin/dscl
|
||||
dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
||||
else
|
||||
string match -v -r '^\s*#' < /etc/passwd | cut -d : -f 1,5 | string replace ':' \t
|
||||
end
|
||||
if test -x /usr/bin/getent
|
||||
getent passwd | cut -d : -f 1,5 | string replace -r ':' \t
|
||||
else if test -x /usr/bin/dscl
|
||||
dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
||||
else
|
||||
string match -v -r '^\s*#' </etc/passwd | cut -d : -f 1,5 | string replace ':' \t
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --argument cfgfiles
|
||||
set -q cfgfiles[0]
|
||||
or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc
|
||||
set -q cfgfiles[0]
|
||||
or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc
|
||||
|
||||
# test if there is an alternative config file specified
|
||||
set -l store_next
|
||||
for opt in (commandline -cpo)
|
||||
if set -q store_next[1]
|
||||
set store_next
|
||||
set cfgfiles $opt
|
||||
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'
|
||||
# test if there is an alternative config file specified
|
||||
set -l store_next
|
||||
for opt in (commandline -cpo)
|
||||
if set -q store_next[1]
|
||||
set store_next
|
||||
set cfgfiles $opt
|
||||
continue
|
||||
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
|
||||
|
|
|
@ -234,7 +234,8 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
# Suppress duplicative title display on Terminal.app
|
||||
if not functions -q fish_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
|
||||
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
|
||||
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 long_opt
|
||||
set -l short_opt
|
||||
set -l long_opt
|
||||
|
||||
for i in $argv
|
||||
if test $next_short
|
||||
set next_short
|
||||
set short_opt $short_opt $i
|
||||
else
|
||||
switch $i
|
||||
case -s
|
||||
set next_short 1
|
||||
case '-*'
|
||||
echo __fish_contains_opt: Unknown option $i
|
||||
return 1
|
||||
for i in $argv
|
||||
if test $next_short
|
||||
set next_short
|
||||
set short_opt $short_opt $i
|
||||
else
|
||||
switch $i
|
||||
case -s
|
||||
set next_short 1
|
||||
case '-*'
|
||||
echo __fish_contains_opt: Unknown option $i
|
||||
return 1
|
||||
|
||||
case '**'
|
||||
set long_opt $long_opt $i
|
||||
end
|
||||
end
|
||||
end
|
||||
case '**'
|
||||
set long_opt $long_opt $i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i in $short_opt
|
||||
for i in $short_opt
|
||||
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
|
||||
if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 0
|
||||
end
|
||||
if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 0
|
||||
end
|
||||
|
||||
if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 0
|
||||
end
|
||||
end
|
||||
if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
for i in $long_opt
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
for i in $long_opt
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
|
||||
if contains -- --$i (commandline -cpo)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
if contains -- --$i (commandline -cpo)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
return 1
|
||||
return 1
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# a function to obtain a list of installed packages with CRUX pkgutils
|
||||
function __fish_crux_packages -d 'Obtain a list of installed packages'
|
||||
pkginfo -i|cut -d' ' -f1
|
||||
pkginfo -i | cut -d' ' -f1
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function __fish_cursor_konsole -d 'Set cursor (konsole)'
|
||||
set -l shape $argv[1]
|
||||
switch "$shape"
|
||||
case block
|
||||
echo -en '\e]50;CursorShape=0\x7'
|
||||
case underscore
|
||||
echo -en '\e]50;CursorShape=2\x7'
|
||||
case line
|
||||
echo -en '\e]50;CursorShape=1\x7'
|
||||
end
|
||||
set -l shape $argv[1]
|
||||
switch "$shape"
|
||||
case block
|
||||
echo -en '\e]50;CursorShape=0\x7'
|
||||
case underscore
|
||||
echo -en '\e]50;CursorShape=2\x7'
|
||||
case line
|
||||
echo -en '\e]50;CursorShape=1\x7'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
function __fish_cursor_xterm -d 'Set cursor (xterm)'
|
||||
set -l shape $argv[1]
|
||||
set -l shape $argv[1]
|
||||
|
||||
switch "$shape"
|
||||
case block
|
||||
set shape 2
|
||||
case underscore
|
||||
set shape 4
|
||||
case line
|
||||
set shape 6
|
||||
end
|
||||
if contains blink $argv
|
||||
set shape (math $shape - 1)
|
||||
end
|
||||
echo -en "\e[$shape q"
|
||||
switch "$shape"
|
||||
case block
|
||||
set shape 2
|
||||
case underscore
|
||||
set shape 4
|
||||
case line
|
||||
set shape 6
|
||||
end
|
||||
if contains blink $argv
|
||||
set shape (math $shape - 1)
|
||||
end
|
||||
echo -en "\e[$shape q"
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
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, ", ");
|
||||
for (name in names)
|
||||
if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -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
|
||||
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
|
||||
else
|
||||
for i in $___fish_git_prompt_status_order
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
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
|
||||
for i in $argv
|
||||
switch $i
|
||||
# Check if we are using a gnu system
|
||||
for i in $argv
|
||||
switch $i
|
||||
|
||||
case -g --is-gnu
|
||||
set is_gnu 1
|
||||
case -g --is-gnu
|
||||
set is_gnu 1
|
||||
|
||||
case '*'
|
||||
set argv_out $argv_out $i
|
||||
end
|
||||
end
|
||||
case '*'
|
||||
set argv_out $argv_out $i
|
||||
end
|
||||
end
|
||||
|
||||
set argv $argv_out
|
||||
set argv_out
|
||||
set -l skip_next 0
|
||||
set argv $argv_out
|
||||
set argv_out
|
||||
set -l skip_next 0
|
||||
|
||||
# Remove long option if not on a gnu system
|
||||
switch $is_gnu
|
||||
case 0
|
||||
for i in $argv
|
||||
# Remove long option if not on a gnu system
|
||||
switch $is_gnu
|
||||
case 0
|
||||
for i in $argv
|
||||
|
||||
switch $skip_next
|
||||
switch $skip_next
|
||||
|
||||
case 1
|
||||
set skip_next 0
|
||||
continue
|
||||
case 1
|
||||
set skip_next 0
|
||||
continue
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
switch $i
|
||||
switch $i
|
||||
|
||||
case -l --long
|
||||
set skip_next 1
|
||||
continue
|
||||
case -l --long
|
||||
set skip_next 1
|
||||
continue
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
set argv_out $argv_out $i
|
||||
end
|
||||
set argv $argv_out
|
||||
set argv_out $argv_out $i
|
||||
end
|
||||
set argv $argv_out
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
complete $argv
|
||||
complete $argv
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -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'
|
||||
# If hg isn't installed, there's nothing we can do
|
||||
# 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
|
||||
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
|
||||
switch $line
|
||||
case 'A ' ; set hg_statuses $hg_statuses added
|
||||
case 'M ' ' M' ; set hg_statuses $hg_statuses modified
|
||||
case 'C ' ; 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
|
||||
case 'A '
|
||||
set hg_statuses $hg_statuses added
|
||||
case 'M ' ' M'
|
||||
set hg_statuses $hg_statuses modified
|
||||
case 'C '
|
||||
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
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
|
||||
function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
|
||||
set cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
set cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
|
||||
case '*'
|
||||
return 1;
|
||||
end
|
||||
end
|
||||
return 0
|
||||
case '*'
|
||||
return 1
|
||||
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
set -l num (count (commandline -poc) additionalelement)
|
||||
test $n -eq $num
|
||||
# Add a fake element to increment without calling math
|
||||
set -l num (count (commandline -poc) additionalelement)
|
||||
test $n -eq $num
|
||||
end
|
||||
|
|
|
@ -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
|
||||
# testing whether it supports `kill -t`; in which case it is the coreutils `kill` command.
|
||||
# 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'.
|
||||
complete -c kill -s l --description "List names of available signals"
|
||||
for i in (seq 31)
|
||||
|
@ -24,7 +25,7 @@ function __fish_make_completion_signals --description 'Make list of kill signals
|
|||
set -g __kill_signals
|
||||
kill -L | sed -e 's/^ //; s/ */ /g; y/ /\n/' | while read -l 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
|
||||
set -g __kill_signals $__kill_signals "$signo $signame"
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_man_page
|
||||
man (basename (commandline -po; echo)[1]) ^/dev/null
|
||||
or printf \a
|
||||
man (basename (commandline -po; echo)[1]) ^/dev/null
|
||||
or printf \a
|
||||
end
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
function __fish_move_last -d "Move the last element of a directory history from src to dest"
|
||||
set -l src $argv[1]
|
||||
set -l dest $argv[2]
|
||||
set -l src $argv[1]
|
||||
set -l dest $argv[2]
|
||||
|
||||
set -l size_src (count $$src)
|
||||
set -l size_src (count $$src)
|
||||
|
||||
if test $size_src = 0
|
||||
# Cannot make this step
|
||||
printf (_ "Hit end of history…\n")
|
||||
return 1
|
||||
end
|
||||
if test $size_src = 0
|
||||
# Cannot make this step
|
||||
printf (_ "Hit end of history…\n")
|
||||
return 1
|
||||
end
|
||||
|
||||
# Append current dir to the end of the destination
|
||||
set -g (echo $dest) $$dest (command pwd)
|
||||
# Append current dir to the end of the destination
|
||||
set -g (echo $dest) $$dest (command pwd)
|
||||
|
||||
set ssrc $$src
|
||||
set ssrc $$src
|
||||
|
||||
# Change dir to the last entry in the source dir-hist
|
||||
builtin cd $ssrc[$size_src]
|
||||
# Change dir to the last entry in the source dir-hist
|
||||
builtin cd $ssrc[$size_src]
|
||||
|
||||
# Keep all but the last from the source dir-hist
|
||||
set -e (echo $src)\[$size_src]
|
||||
# Keep all but the last from the source dir-hist
|
||||
set -e (echo $src)\[$size_src]
|
||||
|
||||
# All ok, return success
|
||||
return 0
|
||||
# All ok, return success
|
||||
return 0
|
||||
end
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
function __fish_no_arguments -d "Internal fish function"
|
||||
set -l cmd (commandline -poc) (commandline -tc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
set -l cmd (commandline -poc) (commandline -tc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
|
||||
case '*'
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
case '*'
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
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 long_opt
|
||||
set -l short_opt
|
||||
set -l long_opt
|
||||
|
||||
for i in $argv
|
||||
if test $next_short
|
||||
set next_short
|
||||
set short_opt $short_opt $i
|
||||
else
|
||||
switch $i
|
||||
case -s
|
||||
set next_short 1
|
||||
case '-*'
|
||||
echo __fish_contains_opt: Unknown option $i
|
||||
return 1
|
||||
for i in $argv
|
||||
if test $next_short
|
||||
set next_short
|
||||
set short_opt $short_opt $i
|
||||
else
|
||||
switch $i
|
||||
case -s
|
||||
set next_short 1
|
||||
case '-*'
|
||||
echo __fish_contains_opt: Unknown option $i
|
||||
return 1
|
||||
|
||||
case '**'
|
||||
set long_opt $long_opt $i
|
||||
end
|
||||
end
|
||||
end
|
||||
case '**'
|
||||
set long_opt $long_opt $i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for i in $short_opt
|
||||
for i in $short_opt
|
||||
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
|
||||
if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 1
|
||||
end
|
||||
if commandline -cpo | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 1
|
||||
end
|
||||
|
||||
if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 1
|
||||
end
|
||||
end
|
||||
if commandline -ct | __fish_sgrep -- "^-"$i"\|^-[^-]*"$i >/dev/null
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
for i in $long_opt
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
for i in $long_opt
|
||||
if test -z $i
|
||||
continue
|
||||
end
|
||||
|
||||
if contains -- --$i (commandline -cpo)
|
||||
return 1
|
||||
end
|
||||
end
|
||||
if contains -- --$i (commandline -cpo)
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
return 0
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function __fish_paginate -d "Paginate the current command using the users default pager"
|
||||
|
||||
set -l cmd less
|
||||
if set -q PAGER
|
||||
set cmd $PAGER
|
||||
end
|
||||
set -l cmd less
|
||||
if set -q PAGER
|
||||
set cmd $PAGER
|
||||
end
|
||||
|
||||
if commandline -j| string match -q -r -v "$cmd *\$"
|
||||
if commandline -j | string match -q -r -v "$cmd *\$"
|
||||
|
||||
commandline -aj " ^&1 |$cmd;"
|
||||
end
|
||||
commandline -aj " ^&1 |$cmd;"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# a function to print 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function __fish_print_addresses --description "Print a list of known network addresses"
|
||||
if command -s ip >/dev/null
|
||||
command ip --oneline address | cut -d" " -f7 | sed "s:\(.*\)/.*:\1:"
|
||||
else if command -s ifconfig >/dev/null
|
||||
# This is for OSX/BSD
|
||||
# There's also linux ifconfig but that has at least two different output formats
|
||||
# is basically dead, and ip is installed on everything now
|
||||
ifconfig | awk '/^\tinet/ { print $2 } '
|
||||
end
|
||||
if command -s ip >/dev/null
|
||||
command ip --oneline address | cut -d" " -f7 | sed "s:\(.*\)/.*:\1:"
|
||||
else if command -s ifconfig >/dev/null
|
||||
# This is for OSX/BSD
|
||||
# There's also linux ifconfig but that has at least two different output formats
|
||||
# is basically dead, and ip is installed on everything now
|
||||
ifconfig | awk '/^\tinet/ { print $2 } '
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function __fish_print_debian_apache_confs
|
||||
# Helper script for completions for a2enconf/a2disconf
|
||||
for conf in /etc/apache2/conf-available/*.conf
|
||||
basename "$conf" .conf
|
||||
end
|
||||
# Helper script for completions for a2enconf/a2disconf
|
||||
for conf in /etc/apache2/conf-available/*.conf
|
||||
basename "$conf" .conf
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function __fish_print_debian_apache_mods
|
||||
# Helper script for completions for a2enmod/a2dismod
|
||||
for mod in /etc/apache2/mods-available/*.load
|
||||
basename "$mod" .load
|
||||
end
|
||||
# Helper script for completions for a2enmod/a2dismod
|
||||
for mod in /etc/apache2/mods-available/*.load
|
||||
basename "$mod" .load
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function __fish_print_debian_apache_sites
|
||||
# Helper script for completions for a2ensite/a2dissite
|
||||
for site in /etc/apache2/sites-available/*
|
||||
basename "$site" .conf
|
||||
end
|
||||
# Helper script for completions for a2ensite/a2dissite
|
||||
for site in /etc/apache2/sites-available/*
|
||||
basename "$site" .conf
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function __fish_print_debian_services --description 'Prints services installed'
|
||||
for service in /etc/init.d/*
|
||||
if [ -x $service ]
|
||||
basename $service
|
||||
for service in /etc/init.d/*
|
||||
if [ -x $service ]
|
||||
basename $service
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function __fish_print_encodings -d "Complete using available character encodings"
|
||||
iconv --list|sed -e 's|//||'
|
||||
iconv --list | sed -e 's|//||'
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
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 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
|
||||
# Mount has helper binaries to mount filesystems
|
||||
# These are called mount.* and are placed somewhere in $PATH
|
||||
printf "%s\n" $fs (string replace -ra ".*/mount." "" -- $PATH/mount.*)
|
||||
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 reiserfs romfs smbfs sysv tmpfs udf ufs umsdos vfat xenix xfs xiafs
|
||||
# Mount has helper binaries to mount filesystems
|
||||
# These are called mount.* and are placed somewhere in $PATH
|
||||
printf "%s\n" $fs (string replace -ra ".*/mount." "" -- $PATH/mount.*)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
function __fish_print_function_prototypes -d "Prints the names of all function prototypes found in the headers in the current directory"
|
||||
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
|
||||
|
||||
|
|
|
@ -1,41 +1,39 @@
|
|||
|
||||
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
|
||||
# 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
|
||||
# Ignore zero ips
|
||||
getent hosts | string match -r -v '^0.0.0.0' \
|
||||
| string replace -r '[0-9.]*\s*' '' | string split " "
|
||||
else if test -r /etc/hosts
|
||||
# Ignore commented lines and functionally empty lines
|
||||
string match -r -v '^\s*0.0.0.0|^\s*#|^\s*$' < /etc/hosts \
|
||||
# Strip comments
|
||||
| string replace -ra '#.*$' '' \
|
||||
| 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
|
||||
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"
|
||||
for file in /etc/ssh/ssh_config ~/.ssh/config
|
||||
if test -r $file
|
||||
# Print hosts from system wide ssh configuration file
|
||||
# Note the non-capturing group to avoid printing "name"
|
||||
string match -ri '\s*Host(?:name)?(?:\s+|\s*=\s*)\w.*' < $file | string replace -ri '^\s*Host(?:name)?\s*(\S+)' '$1' \
|
||||
| string replace -r '\s+' ' ' | string split ' '
|
||||
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \
|
||||
| string replace -ri '.*KnownHostsFile\s*' '')
|
||||
end
|
||||
end
|
||||
for file in $known_hosts
|
||||
# Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200)
|
||||
test -r $file; and string replace -ra '(\S+) .*' '$1' < $file | string match -r '^[^#|[=]+$' | string split ","
|
||||
end
|
||||
return 0
|
||||
# Print all hosts from /etc/hosts
|
||||
# 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
|
||||
# Ignore zero ips
|
||||
getent hosts | string match -r -v '^0.0.0.0' | string replace -r '[0-9.]*\s*' '' | string split " "
|
||||
else if test -r /etc/hosts
|
||||
# Ignore commented lines and functionally empty lines
|
||||
string match -r -v '^\s*0.0.0.0|^\s*#|^\s*$' </etc/hosts # Strip comments
|
||||
| string replace -ra '#.*$' '' | 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
|
||||
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"
|
||||
for file in /etc/ssh/ssh_config ~/.ssh/config
|
||||
if test -r $file
|
||||
# Print hosts from system wide ssh configuration file
|
||||
# Note the non-capturing group to avoid printing "name"
|
||||
string match -ri '\s*Host(?:name)?(?:\s+|\s*=\s*)\w.*' <$file | string replace -ri '^\s*Host(?:name)?\s*(\S+)' '$1' | string replace -r '\s+' ' ' | string split ' '
|
||||
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' < $file \
|
||||
| string replace -ri '.*KnownHostsFile\s*' '')
|
||||
end
|
||||
end
|
||||
for file in $known_hosts
|
||||
# Ignore hosts that are hashed, commented or have custom ports (like [localhost]:2200)
|
||||
test -r $file
|
||||
and string replace -ra '(\S+) .*' '$1' <$file | string match -r '^[^#|[=]+$' | string split ","
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
function __fish_print_interfaces --description "Print a list of known network interfaces"
|
||||
if test -d /sys/class/net
|
||||
cd /sys/class/net
|
||||
for i in *
|
||||
echo $i
|
||||
end
|
||||
else # OSX/BSD
|
||||
command ifconfig -l | string split ' '
|
||||
end
|
||||
if test -d /sys/class/net
|
||||
cd /sys/class/net
|
||||
for i in *
|
||||
echo $i
|
||||
end
|
||||
else # OSX/BSD
|
||||
command ifconfig -l | string split ' '
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
function __fish_print_make_targets
|
||||
# Some seds (e.g. on Mac OS X), don't support \n in the RHS
|
||||
# Use a literal newline instead
|
||||
# http://sed.sourceforge.net/sedfaq4.html#s4.1
|
||||
# The 'rev | cut | rev' trick removes everything after the last colon
|
||||
for file in GNUmakefile Makefile makefile
|
||||
if test -f $file
|
||||
__fish_sgrep -h -o -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $file ^/dev/null | rev | cut -d ":" -f 2- | rev | sed -e 's/^ *//;s/ *$//;s/ */\\
|
||||
# Some seds (e.g. on Mac OS X), don't support \n in the RHS
|
||||
# Use a literal newline instead
|
||||
# http://sed.sourceforge.net/sedfaq4.html#s4.1
|
||||
# The 'rev | cut | rev' trick removes everything after the last colon
|
||||
for file in GNUmakefile Makefile makefile
|
||||
if test -f $file
|
||||
__fish_sgrep -h -o -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $file ^/dev/null | rev | cut -d ":" -f 2- | rev | sed -e 's/^ *//;s/ *$//;s/ */\\
|
||||
/g' ^/dev/null
|
||||
# On case insensitive filesystems, Makefile and makefile are the same; stop now so we don't double-print
|
||||
break
|
||||
end
|
||||
end
|
||||
# On case insensitive filesystems, Makefile and makefile are the same; stop now so we don't double-print
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Helper function for completions that need to enumerate Linux 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
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
function __fish_print_mounted --description 'Print mounted devices'
|
||||
if test -r /etc/mtab
|
||||
# In mtab, spaces are replaced by a literal '\040'
|
||||
# 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
|
||||
# This will probably break on newlines because of our splitting, though
|
||||
# and tabs because of descriptions
|
||||
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 "\\\\" "\\"
|
||||
else
|
||||
mount | cut -d " " -f 1-3|tr " " \n|sed -e "s/[0-9\.]*:\//\//"| __fish_sgrep "^/"
|
||||
end
|
||||
if test -r /etc/mtab
|
||||
# In mtab, spaces are replaced by a literal '\040'
|
||||
# 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
|
||||
# This will probably break on newlines because of our splitting, though
|
||||
# and tabs because of descriptions
|
||||
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 "\\\\" "\\"
|
||||
else
|
||||
mount | cut -d " " -f 1-3 | tr " " \n | sed -e "s/[0-9\.]*:\//\//" | __fish_sgrep "^/"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function __fish_print_ninja_targets
|
||||
if [ -f build.ninja ]
|
||||
ninja -t targets 2> /dev/null | string replace -r ':.*' ''
|
||||
ninja -t targets 2>/dev/null | string replace -r ':.*' ''
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,139 +1,139 @@
|
|||
|
||||
function __fish_print_packages
|
||||
|
||||
# apt-cache is much, much faster than rpm, and can do this in real
|
||||
# time. We use it if available.
|
||||
# apt-cache is much, much faster than rpm, and can do this in real
|
||||
# time. We use it if available.
|
||||
|
||||
switch (commandline -tc)
|
||||
case '-**'
|
||||
return
|
||||
end
|
||||
switch (commandline -tc)
|
||||
case '-**'
|
||||
return
|
||||
end
|
||||
|
||||
#Get the word 'Package' in the current language
|
||||
set -l package (_ Package)
|
||||
#Get the word 'Package' in the current language
|
||||
set -l package (_ Package)
|
||||
|
||||
# Set up cache directory
|
||||
if test -z "$XDG_CACHE_HOME"
|
||||
set XDG_CACHE_HOME $HOME/.cache
|
||||
end
|
||||
mkdir -m 700 -p $XDG_CACHE_HOME
|
||||
# Set up cache directory
|
||||
if test -z "$XDG_CACHE_HOME"
|
||||
set XDG_CACHE_HOME $HOME/.cache
|
||||
end
|
||||
mkdir -m 700 -p $XDG_CACHE_HOME
|
||||
|
||||
if type -q -f apt-cache
|
||||
# Do not generate the cache as apparently sometimes this is slow.
|
||||
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547550
|
||||
apt-cache --no-generate pkgnames (commandline -tc) ^/dev/null | sed -e 's/$/'\t$package'/'
|
||||
return
|
||||
end
|
||||
if type -q -f apt-cache
|
||||
# Do not generate the cache as apparently sometimes this is slow.
|
||||
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547550
|
||||
apt-cache --no-generate pkgnames (commandline -tc) ^/dev/null | sed -e 's/$/'\t$package'/'
|
||||
return
|
||||
end
|
||||
|
||||
# Pkg is fast on FreeBSD and provides versioning info which we want for
|
||||
# installed packages
|
||||
if begin
|
||||
type -q -f pkg
|
||||
and test (uname) = "FreeBSD"
|
||||
end
|
||||
pkg query "%n-%v"
|
||||
return
|
||||
end
|
||||
# Pkg is fast on FreeBSD and provides versioning info which we want for
|
||||
# installed packages
|
||||
if begin
|
||||
type -q -f pkg
|
||||
and test (uname) = "FreeBSD"
|
||||
end
|
||||
pkg query "%n-%v"
|
||||
return
|
||||
end
|
||||
|
||||
# Caches for 5 minutes
|
||||
if type -q -f pacman
|
||||
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
if type -q -f pacman
|
||||
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# prints: <package name> Package
|
||||
pacman -Ssq | sed -e 's/$/\t'$package'/' >$cache_file &
|
||||
return
|
||||
end
|
||||
# prints: <package name> Package
|
||||
pacman -Ssq | sed -e 's/$/\t'$package'/' >$cache_file &
|
||||
return
|
||||
end
|
||||
|
||||
# Zypper needs caching as it is slow
|
||||
if type -q -f zypper
|
||||
# Use libzypp cache file if available
|
||||
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'}'
|
||||
return
|
||||
end
|
||||
# Zypper needs caching as it is slow
|
||||
if type -q -f zypper
|
||||
# Use libzypp cache file if available
|
||||
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'}'
|
||||
return
|
||||
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
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set -l max_age 300
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
set -l cache_file $XDG_CACHE_HOME/.zypper-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set -l max_age 300
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# 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 &
|
||||
return
|
||||
end
|
||||
# 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 &
|
||||
return
|
||||
end
|
||||
|
||||
# yum is slow, just like rpm, so go to the background
|
||||
if type -q -f /usr/share/yum-cli/completion-helper.py
|
||||
# yum is slow, just like rpm, so go to the background
|
||||
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
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 21600
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
set cache_file $XDG_CACHE_HOME/.yum-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 21600
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# 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 &
|
||||
return
|
||||
end
|
||||
# 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 &
|
||||
return
|
||||
end
|
||||
|
||||
# Rpm is too slow for this job, so we set it up to do completions
|
||||
# as a background job and cache the results.
|
||||
# Rpm is too slow for this job, so we set it up to do completions
|
||||
# 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
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
set cache_file $XDG_CACHE_HOME/.rpm-cache.$USER
|
||||
if test -f $cache_file
|
||||
cat $cache_file
|
||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||
set max_age 250
|
||||
if test $age -lt $max_age
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# Remove package version information from output and pipe into cache file
|
||||
rpm -qa |sed -e 's/-[^-]*-[^-]*$/\t'$package'/' >$cache_file &
|
||||
return
|
||||
end
|
||||
# Remove package version information from output and pipe into cache file
|
||||
rpm -qa | sed -e 's/-[^-]*-[^-]*$/\t'$package'/' >$cache_file &
|
||||
return
|
||||
end
|
||||
|
||||
# This completes the package name from the portage tree.
|
||||
# True for installing new packages. Function for printing
|
||||
# installed on the system packages is in completions/emerge.fish
|
||||
# This completes the package name from the portage tree.
|
||||
# True for installing new packages. Function for printing
|
||||
# installed on the system packages is in completions/emerge.fish
|
||||
|
||||
# eix is MUCH faster than emerge so use it if it is available
|
||||
if type -q -f eix
|
||||
eix --only-names "^"(commandline -tc) | cut -d/ -f2
|
||||
return
|
||||
else
|
||||
# FIXME? Seems to be broken
|
||||
if type -q -f emerge
|
||||
emerge -s \^(commandline -tc) | __fish_sgrep "^*" |cut -d\ -f3 |cut -d/ -f2
|
||||
return
|
||||
end
|
||||
end
|
||||
# eix is MUCH faster than emerge so use it if it is available
|
||||
if type -q -f eix
|
||||
eix --only-names "^"(commandline -tc) | cut -d/ -f2
|
||||
return
|
||||
else
|
||||
# FIXME? Seems to be broken
|
||||
if type -q -f emerge
|
||||
emerge -s \^(commandline -tc) | __fish_sgrep "^*" | cut -d\ -f3 | cut -d/ -f2
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function __fish_print_service_names -d 'All services known to the system'
|
||||
if test -d /run/systemd/system # Systemd systems
|
||||
# For the `service` command, this needs to be without the type suffix
|
||||
# on Debian at least
|
||||
__fish_systemctl_services | string replace -r '.service$' ''
|
||||
# For the `service` command, this needs to be without the type suffix
|
||||
# on Debian at least
|
||||
__fish_systemctl_services | string replace -r '.service$' ''
|
||||
else if type -f rc-service ^/dev/null # OpenRC (Gentoo)
|
||||
command rc-service -l
|
||||
else if test -d /etc/init.d # SysV on Debian and other linuxen
|
||||
string replace '/etc/init.d/' '' -- /etc/init.d/*
|
||||
else # Freebsd
|
||||
command service -l
|
||||
string replace '/etc/init.d/' '' -- /etc/init.d/*
|
||||
else # Freebsd
|
||||
command service -l
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
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
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
function __fish_print_users --description "Print a list of local users"
|
||||
if test -x /usr/bin/getent
|
||||
getent passwd | cut -d : -f 1
|
||||
else if test -x /usr/bin/dscl # OS X support
|
||||
dscl . -list /Users | string match -r -v '^_'
|
||||
else
|
||||
string match -v -r '^\w*#' < /etc/passwd | cut -d : -f 1
|
||||
end
|
||||
if test -x /usr/bin/getent
|
||||
getent passwd | cut -d : -f 1
|
||||
else if test -x /usr/bin/dscl # OS X support
|
||||
dscl . -list /Users | string match -r -v '^_'
|
||||
else
|
||||
string match -v -r '^\w*#' </etc/passwd | cut -d : -f 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function __fish_print_xdg_mimetypes --description 'Print XDG mime types'
|
||||
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
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function __fish_print_xrandr_modes --description 'Print xrandr modes'
|
||||
set -l out
|
||||
xrandr | sed '/^Screen/d; s/^ \+/mode: /' | while read -l output mode misc
|
||||
switch $output
|
||||
case mode:
|
||||
echo $mode\t(echo $misc | sed 's/\(^ \+\)\|\( *$\)//') [$out]
|
||||
case '*'
|
||||
set out $output
|
||||
end
|
||||
end
|
||||
set -l out
|
||||
xrandr | sed '/^Screen/d; s/^ \+/mode: /' | while read -l output mode misc
|
||||
switch $output
|
||||
case mode:
|
||||
echo $mode\t(echo $misc | sed 's/\(^ \+\)\|\( *$\)//') [$out]
|
||||
case '*'
|
||||
set out $output
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# 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'
|
||||
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
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
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
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# a function to obtain a list of installed packages with prt-get
|
||||
function __fish_prt_packages -d 'Obtain a list of installed packages'
|
||||
prt-get listinst
|
||||
prt-get listinst
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# a function to obtain a list of ports with prt-get
|
||||
|
||||
function __fish_prt_ports -d 'Obtain a list of ports'
|
||||
prt-get list
|
||||
prt-get list
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# 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'
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i update remove lock unlock current
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i update remove lock unlock current
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# 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'
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i install depinst grpinst diff depends quickdep dependent deptree isinst info path readme ls cat edit
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
for i in (commandline -opc)
|
||||
if contains -- $i install depinst grpinst diff depends quickdep dependent deptree isinst info path readme ls cat edit
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
switch (uname)
|
||||
case 'CYGWIN_*'
|
||||
function __fish_pwd --description "Show current path"
|
||||
pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u\1:/-'
|
||||
end
|
||||
case '*'
|
||||
function __fish_pwd --description "Show current path"
|
||||
pwd
|
||||
end
|
||||
case 'CYGWIN_*'
|
||||
function __fish_pwd --description "Show current path"
|
||||
pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u\1:/-'
|
||||
end
|
||||
case '*'
|
||||
function __fish_pwd --description "Show current path"
|
||||
pwd
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
function __fish_sgrep -d "Call grep without honoring GREP_OPTIONS settings"
|
||||
set -l GREP_OPTIONS
|
||||
command grep $argv
|
||||
set -l GREP_OPTIONS
|
||||
command grep $argv
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
|||
end
|
||||
|
||||
bind $argv \cy yank
|
||||
or return # protect against invalid $argv
|
||||
or return # protect against invalid $argv
|
||||
bind $argv \ey yank-pop
|
||||
|
||||
# Left/Right arrow
|
||||
|
|
|
@ -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"
|
||||
# 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`
|
||||
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.
|
||||
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
|
||||
for flag_type in $__fish_svn_prompt_flag_names
|
||||
# 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)
|
||||
# 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 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_color __fish_svn_prompt_char_{$flag_type}_color
|
||||
# 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)
|
||||
end
|
||||
end
|
||||
# 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`
|
||||
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.
|
||||
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
|
||||
for flag_type in $__fish_svn_prompt_flag_names
|
||||
# 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)
|
||||
# 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 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_color __fish_svn_prompt_char_{$flag_type}_color
|
||||
# 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)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function __fish_svn_prompt --description "Prompt function for svn"
|
||||
# if svn isn't installed then don't do anything
|
||||
if not command -s svn > /dev/null
|
||||
return 1
|
||||
end
|
||||
# if svn isn't installed then don't do anything
|
||||
if not command -s svn >/dev/null
|
||||
return 1
|
||||
end
|
||||
|
||||
# make sure that this is a svn repo
|
||||
set -l checkout_info (command svn info ^/dev/null)
|
||||
if [ $status -ne 0 ];
|
||||
return
|
||||
end
|
||||
# make sure that this is a svn repo
|
||||
set -l checkout_info (command svn info ^/dev/null)
|
||||
if [ $status -ne 0 ]
|
||||
|
||||
# get the current revision number
|
||||
printf '(%s%s%s' (set_color $__fish_svn_prompt_color_revision) (__fish_print_svn_rev) (set_color normal)
|
||||
return
|
||||
end
|
||||
|
||||
# resolve the status of the checkout
|
||||
# 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)
|
||||
# get the current revision number
|
||||
printf '(%s%s%s' (set_color $__fish_svn_prompt_color_revision) (__fish_print_svn_rev) (set_color normal)
|
||||
|
||||
# track the last column to contain a status flag
|
||||
set -l last_column 0
|
||||
# resolve the status of the checkout
|
||||
# 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`)
|
||||
for col in (seq 7)
|
||||
# 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')
|
||||
# track the last column to contain a status flag
|
||||
set -l last_column 0
|
||||
|
||||
# check that the character count is not zero (this would indicate that there are status flags in this column)
|
||||
if [ (count $column_status) -ne 0 ];
|
||||
# we only want to display unique status flags (eg: if there are 5 modified files, the prompt should only show the modified status once)
|
||||
set -l column_unique_status (echo $column_status | sort | uniq)
|
||||
# parse the status flags for this column and create the formatting by calling out to the helper function
|
||||
set -l svn_status_flags (__fish_svn_prompt_parse_status $column_unique_status)
|
||||
# iterate over the 7 columns of output (the 7 columns are defined on `svn help status`)
|
||||
for col in (seq 7)
|
||||
# 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')
|
||||
|
||||
# the default separator is empty
|
||||
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
|
||||
# check that the character count is not zero (this would indicate that there are status flags in this column)
|
||||
if [ (count $column_status) -ne 0 ]
|
||||
|
||||
# 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
|
||||
# we only want to display unique status flags (eg: if there are 5 modified files, the prompt should only show the modified status once)
|
||||
set -l column_unique_status (echo $column_status | sort | uniq)
|
||||
# parse the status flags for this column and create the formatting by calling out to the helper function
|
||||
set -l svn_status_flags (__fish_svn_prompt_parse_status $column_unique_status)
|
||||
|
||||
# print the close of the svn status prompt
|
||||
printf ')'
|
||||
# the default separator is empty
|
||||
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
|
|
@ -1,9 +1,9 @@
|
|||
function __fish_systemctl_automounts
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function __fish_systemctl_devices
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
# Devices are usually generated at runtime
|
||||
# Therefore show known _units_, not unit-files
|
||||
systemctl --user list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
# Devices are usually generated at runtime
|
||||
# Therefore show known _units_, not unit-files
|
||||
systemctl --user list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
function __fish_systemctl_mounts
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function __fish_systemctl_scopes
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
# Scopes are usually generated at runtime
|
||||
# Therefore show known _units_, not unit-files
|
||||
systemctl --user list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
# Scopes are usually generated at runtime
|
||||
# Therefore show known _units_, not unit-files
|
||||
systemctl --user list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
function __fish_systemctl_service_paths
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-unit-files --no-legend --type=path ^/dev/null $argv | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function __fish_systemctl_services
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
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 ' '
|
||||
else
|
||||
# list-unit-files will also show disabled units
|
||||
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)
|
||||
systemctl list-units --state=loaded --no-legend --type=service ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
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 ' '
|
||||
else
|
||||
# list-unit-files will also show disabled units
|
||||
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)
|
||||
systemctl list-units --state=loaded --no-legend --type=service ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function __fish_systemctl_slices
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
# Slices are usually generated at runtime
|
||||
# Therefore show known _units_, not unit-files
|
||||
systemctl --user list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
# Slices are usually generated at runtime
|
||||
# Therefore show known _units_, not unit-files
|
||||
systemctl --user list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
|
||||
else
|
||||
systemctl list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue