mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 09:45:25 +08:00
Remove use of caret redirection from share/*
This removes the use of caret redirections from share/completions and share/functions, in preparation for dropping support in fish.
This commit is contained in:
parent
95e5af7814
commit
7659554dea
|
@ -84,7 +84,7 @@ complete -c ack -l bar -d 'The warning admiral'
|
|||
|
||||
# File types
|
||||
if type ack > /dev/null
|
||||
for type in (ack --dump ^/dev/null | perl -lne 'print $1 if /^\s+--type-add=([^:]+)/' | uniq)
|
||||
for type in (ack --dump 2>/dev/null | perl -lne 'print $1 if /^\s+--type-add=([^:]+)/' | uniq)
|
||||
complete -c ack -l $type -d "Allow $type file type"
|
||||
complete -c ack -l no$type -l no-$type -d "Don't allow $type file type"
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ function __fish_adb_run_command -d 'Runs adb with any -s parameters already give
|
|||
end
|
||||
|
||||
function __fish_adb_list_packages
|
||||
__fish_adb_run_command pm list packages ^/dev/null | string replace 'package:' ''
|
||||
__fish_adb_run_command pm list packages 2>/dev/null | string replace 'package:' ''
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ function __fish_apm_list_packages
|
|||
apm list -b
|
||||
end
|
||||
|
||||
if apm -h ^| string match -q "*Atom Package Manager*"
|
||||
if apm -h 2>| string match -q "*Atom Package Manager*"
|
||||
# Completions for Atom Package Manager
|
||||
|
||||
##################
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
function __fish_complete_apropos
|
||||
if test (commandline -ct)
|
||||
set str (commandline -ct)
|
||||
apropos $str ^/dev/null |sed -e "s/^\(.*$str\([^ ]*\).*\)\$/$str\2"\t"\1/"
|
||||
apropos $str 2>/dev/null |sed -e "s/^\(.*$str\([^ ]*\).*\)\$/$str\2"\t"\1/"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function __fish_busctl
|
|||
else
|
||||
set mode "--system"
|
||||
end
|
||||
command busctl $mode $argv --no-legend --no-pager ^/dev/null
|
||||
command busctl $mode $argv --no-legend --no-pager 2>/dev/null
|
||||
end
|
||||
|
||||
# Only get the arguments to the actual command, skipping all options and arguments to options
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if cat --version ^ /dev/null > /dev/null # GNU
|
||||
if cat --version 2>/dev/null > /dev/null # GNU
|
||||
complete -c cat -s A -l show-all -d "Escape all non-printing characters"
|
||||
complete -c cat -s b -l number-nonblank -d "Number nonblank lines"
|
||||
complete -c cat -s e -d "Escape non-printing characters except tab"
|
||||
|
|
|
@ -10,6 +10,6 @@ complete -x -c chsh -a "(__fish_complete_users)"
|
|||
|
||||
# util-linux's chsh also has a "-l"/"--list-shells" option.
|
||||
# While both FreeBSD and macOS also have "-l", it means something different and probably uninteresting.
|
||||
if set -l chshversion (chsh --version ^/dev/null); and string match -qr '.*util-linux.*' -- $chshversion
|
||||
if set -l chshversion (chsh --version 2>/dev/null); and string match -qr '.*util-linux.*' -- $chshversion
|
||||
complete -f -c chsh -s l -l list-shells -d "List available shells and exit"
|
||||
end
|
||||
|
|
|
@ -20,4 +20,4 @@ complete -c cower -f -s v -l 'verbose' -d 'Output more'
|
|||
|
||||
# Complete with AUR packages:
|
||||
# If the search string is too short, cower prints an annoying message to stderr - ignore that
|
||||
complete -c cower -f -n 'not string match -q -- "-*" (commandline --current-token)' -a '(cower --format="%n\t%d\n" --search (commandline --current-token) ^/dev/null)'
|
||||
complete -c cower -f -n 'not string match -q -- "-*" (commandline --current-token)' -a '(cower --format="%n\t%d\n" --search (commandline --current-token) 2>/dev/null)'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if cp --version ^ /dev/null > /dev/null # GNU
|
||||
if cp --version 2>/dev/null > /dev/null # GNU
|
||||
complete -c cp -s a -l archive -d "Same as -dpR"
|
||||
complete -c cp -s b -l backup -d "Make backup of each existing destination file" -a "none off numbered t existing nil simple never"
|
||||
complete -c cp -l copy-contents -d "Copy contents of special files when recursive"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if date --version > /dev/null ^ /dev/null
|
||||
if date --version > /dev/null 2>/dev/null
|
||||
complete -c date -s d -l date -d "Display date described by string" -x
|
||||
complete -c date -s f -l file -d "Display date for each line in file" -r
|
||||
complete -c date -s I -l iso-8601 -d "Output in ISO 8601 format" -x -a "date hours minutes seconds"
|
||||
|
|
|
@ -7,7 +7,7 @@ function __fish_dconf_keys
|
|||
# because it allows us to complete non-incrementally
|
||||
# i.e. to get the keys directly, without going through
|
||||
# `dconf list /`, `dconf list /org/` and so on.
|
||||
dconf dump / ^/dev/null | while read -l line
|
||||
dconf dump / 2>/dev/null | while read -l line
|
||||
if string match -q "[*]" -- $line
|
||||
# New directory - just save it for the keys
|
||||
set dir /(string trim -c "[]" -- $line)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
|
||||
set -l is_gnu
|
||||
df --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
|
||||
df --version >/dev/null 2>/dev/null; and set is_gnu --is-gnu
|
||||
|
||||
__fish_gnu_complete -c df -s h -l human-readable -d "Human readable sizes" $is_gnu
|
||||
__fish_gnu_complete -c df -s i -l inodes -d "List inode information" $is_gnu
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# First parameter is the profile name, or 'usage'
|
||||
complete --command duply --no-files --condition '__fish_is_first_token' --arguments '(/bin/ls /etc/duply ^/dev/null) (/bin/ls ~/.duply ^/dev/null)' -d 'Profile'
|
||||
complete --command duply --no-files --condition '__fish_is_first_token' --arguments '(/bin/ls /etc/duply 2>/dev/null) (/bin/ls ~/.duply 2>/dev/null)' -d 'Profile'
|
||||
complete --command duply --no-files --arguments 'usage' -d 'Get usage help text'
|
||||
|
||||
# Second parameter is a duply command
|
||||
|
|
|
@ -19,7 +19,7 @@ function __fish_complete_eselect_action_options
|
|||
|
||||
# Alter further php completion
|
||||
if [ (__fish_print_cmd_args_without_options)[2] = 'php' ]
|
||||
eselect php list-modules ^/dev/null | string split " "
|
||||
eselect php list-modules 2>/dev/null | string split " "
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ function __fish_complete_eselect_php_actions
|
|||
set -l sedregexp 's/^\s*\[([0-9]+)\]\s+([A-Za-z0-9\.]+).*/\1\t\2/'
|
||||
|
||||
if test (__fish_print_cmd_args_without_options)[3] = 'set'
|
||||
eselect php list (__fish_print_cmd_args_without_options)[-1] ^/dev/null | sed -r $sedregexp
|
||||
eselect php list (__fish_print_cmd_args_without_options)[-1] 2>/dev/null | sed -r $sedregexp
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# http://www.fossil-scm.org/
|
||||
|
||||
function __fish_fossil
|
||||
command fossil $argv ^/dev/null
|
||||
command fossil $argv 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_fossil_needs_command
|
||||
|
|
|
@ -6,26 +6,26 @@ function __fish_git_commits
|
|||
# This allows filtering by subject with the new pager!
|
||||
# Because even subject lines can be quite long,
|
||||
# trim them (abbrev'd hash+tab+subject) to 73 characters
|
||||
command git log --pretty=tformat:"%h"\t"%s" --all --max-count=1000 ^/dev/null | string replace -r '(.{73}).+' '$1…'
|
||||
command git log --pretty=tformat:"%h"\t"%s" --all --max-count=1000 2>/dev/null | string replace -r '(.{73}).+' '$1…'
|
||||
end
|
||||
|
||||
function __fish_git_recent_commits
|
||||
# Like __fish_git_commits, but not on all branches and limited to
|
||||
# the last 50 commits. Used for fixup, where only the current branch
|
||||
# and the latest commits make sense.
|
||||
command git log --pretty=tformat:"%h"\t"%s" --max-count=50 ^/dev/null | string replace -r '(.{73}).+' '$1…'
|
||||
command git log --pretty=tformat:"%h"\t"%s" --max-count=50 2>/dev/null | string replace -r '(.{73}).+' '$1…'
|
||||
end
|
||||
|
||||
function __fish_git_branches
|
||||
command git branch --no-color -a $argv ^/dev/null # Filter out detached heads and such ("(HEAD detached at SOMESHA)", localized). | string match -v '\* (*)' | string match -r -v ' -> ' | string trim -c "* " # We assume anything that's not remote is a local branch. | string replace -r '^(?!remotes/)(.*)' '$1\tLocal Branch' | string replace -r "^remotes/(.*)" '$1\tRemote Branch'
|
||||
command git branch --no-color -a $argv 2>/dev/null # Filter out detached heads and such ("(HEAD detached at SOMESHA)", localized). | string match -v '\* (*)' | string match -r -v ' -> ' | string trim -c "* " # We assume anything that's not remote is a local branch. | string replace -r '^(?!remotes/)(.*)' '$1\tLocal Branch' | string replace -r "^remotes/(.*)" '$1\tRemote Branch'
|
||||
end
|
||||
|
||||
function __fish_git_tags
|
||||
command git tag --sort=-creatordate ^/dev/null
|
||||
command git tag --sort=-creatordate 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_git_dir
|
||||
command git rev-parse --git-dir ^/dev/null
|
||||
command git rev-parse --git-dir 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_git_heads
|
||||
|
@ -44,7 +44,7 @@ function __fish_git_refs
|
|||
end
|
||||
|
||||
function __fish_git_remotes
|
||||
command git remote ^/dev/null
|
||||
command git remote 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_git_files
|
||||
|
@ -65,7 +65,7 @@ function __fish_git_files
|
|||
# to get _all_ kinds of staged files.
|
||||
|
||||
# Save the repo root to remove it from the path later.
|
||||
set -l root (command git rev-parse --show-toplevel ^/dev/null)
|
||||
set -l root (command git rev-parse --show-toplevel 2>/dev/null)
|
||||
|
||||
# Cache the translated descriptions so we don't have to get it
|
||||
# once per file.
|
||||
|
@ -288,11 +288,11 @@ function __fish_git_stash_not_using_subcommand
|
|||
end
|
||||
|
||||
function __fish_git_complete_stashes
|
||||
command git stash list --format=%gd:%gs ^/dev/null | string replace ":" \t
|
||||
command git stash list --format=%gd:%gs 2>/dev/null | string replace ":" \t
|
||||
end
|
||||
|
||||
function __fish_git_aliases
|
||||
command git config -z --get-regexp '^alias\.' ^/dev/null | while read -lz key value
|
||||
command git config -z --get-regexp '^alias\.' 2>/dev/null | while read -lz key value
|
||||
begin
|
||||
set -l name (string replace -r '^.*\.' '' -- $key)
|
||||
printf "%s\t%s\n" $name "Alias for $value"
|
||||
|
@ -345,14 +345,14 @@ function __fish_git_possible_commithash
|
|||
end
|
||||
|
||||
function __fish_git_reflog
|
||||
command git reflog --no-decorate ^/dev/null | string replace -r '[0-9a-f]* (.+@\{[0-9]+\}): (.*)$' '$1\t$2'
|
||||
command git reflog --no-decorate 2>/dev/null | string replace -r '[0-9a-f]* (.+@\{[0-9]+\}): (.*)$' '$1\t$2'
|
||||
end
|
||||
|
||||
# general options
|
||||
complete -f -c git -l help -d 'Display the manual of a git command'
|
||||
complete -f -c git -n '__fish_git_needs_command' -l version -d 'Display version'
|
||||
complete -x -c git -n '__fish_git_needs_command' -s C -a '(__fish_complete_directories)' -d 'Run as if git was started in this directory'
|
||||
complete -x -c git -n '__fish_git_needs_command' -s c -a '(command git config -l ^/dev/null | string replace = \t)' -d 'Set a configuration option'
|
||||
complete -x -c git -n '__fish_git_needs_command' -s c -a '(command git config -l 2>/dev/null | string replace = \t)' -d 'Set a configuration option'
|
||||
complete -x -c git -n '__fish_git_needs_command' -l exec-path -a '(__fish_git_complete_directories)' -d 'Get or set the path to the git programs'
|
||||
complete -f -c git -n '__fish_git_needs_command' -l html-path -d 'Print the path to the html documentation'
|
||||
complete -f -c git -n '__fish_git_needs_command' -l man-path -d 'Print the path to the man documentation'
|
||||
|
|
|
@ -48,7 +48,7 @@ function __cache_or_get_gradle_completion
|
|||
set -l hashed_pwd (fish_md5 -s $PWD)
|
||||
set -l gradle_cache_file $XDG_CACHE_HOME/gradle-completions/$hashed_pwd
|
||||
if not test -f $gradle_cache_file; or command test build.gradle -nt $gradle_cache_file
|
||||
command gradle -q tasks ^/dev/null | string match -r '^[[:alnum:]]+ - .*' | string replace ' - ' \t > $gradle_cache_file
|
||||
command gradle -q tasks 2>/dev/null | string match -r '^[[:alnum:]]+ - .*' | string replace ' - ' \t > $gradle_cache_file
|
||||
end
|
||||
cat $gradle_cache_file
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
|
||||
|
||||
function __grunt_print_tasks
|
||||
set -l tasks (grunt --version --verbose ^/dev/null | awk '/Available tasks: / {$1=$2=""; print $0}' | awk '{$1=$1}1' | tr ' ' '\n')
|
||||
set -l tasks (grunt --version --verbose 2>/dev/null | awk '/Available tasks: / {$1=$2=""; print $0}' | awk '{$1=$1}1' | tr ' ' '\n')
|
||||
for t in $tasks
|
||||
echo $t
|
||||
end
|
||||
|
|
|
@ -27,11 +27,11 @@ function __fish_complete_gsettings_args
|
|||
|
||||
if not set -q cmd[2]
|
||||
# Non-relocatable schemas
|
||||
gsettings $schemadir list-schemas ^/dev/null
|
||||
gsettings $schemadir list-schemas 2>/dev/null
|
||||
|
||||
# Relocatable schemas require a dconf path, but there is no universal way of
|
||||
# finding the right paths to suggest here. Just default to '/'.
|
||||
gsettings $schemadir list-relocatable-schemas ^/dev/null | string replace -r \$ ':/'
|
||||
gsettings $schemadir list-relocatable-schemas 2>/dev/null | string replace -r \$ ':/'
|
||||
return 0
|
||||
end
|
||||
|
||||
|
@ -42,7 +42,7 @@ function __fish_complete_gsettings_args
|
|||
set -l schema $cmd[2]
|
||||
|
||||
if not set -q cmd[3]
|
||||
gsettings $schemadir list-keys $schema ^/dev/null
|
||||
gsettings $schemadir list-keys $schema 2>/dev/null
|
||||
return 0
|
||||
end
|
||||
|
||||
|
@ -52,7 +52,7 @@ function __fish_complete_gsettings_args
|
|||
|
||||
if not set -q cmd[4]
|
||||
set -l key $cmd[3]
|
||||
set -l range (gsettings $schemadir range $schema $key ^/dev/null)
|
||||
set -l range (gsettings $schemadir range $schema $key 2>/dev/null)
|
||||
set -l key_type $range[1]
|
||||
set -e range[1]
|
||||
switch $key_type
|
||||
|
@ -64,7 +64,7 @@ function __fish_complete_gsettings_args
|
|||
case '*'
|
||||
# If no sensible suggestions can be made, just use the current value.
|
||||
# It gives a good indication on the expected format and is likely already close to what the user wants.
|
||||
gsettings $schemadir get $schema $key ^/dev/null
|
||||
gsettings $schemadir get $schema $key 2>/dev/null
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if head --version >/dev/null ^/dev/null
|
||||
if head --version >/dev/null 2>/dev/null
|
||||
complete -c head -s c -l bytes -d 'Print the first N bytes; Leading '-', truncate the last N bytes' -r
|
||||
complete -c head -s n -l lines -d 'Print the first N lines; Leading '-', truncate the last N lines' -r
|
||||
complete -c head -s q -l quiet -l silent -d 'Never print file names'
|
||||
|
|
|
@ -68,7 +68,7 @@ function __helm_subcommands -a cmd
|
|||
end
|
||||
|
||||
function __helm_kube_contexts
|
||||
kubectl config get-contexts -o name ^/dev/null
|
||||
kubectl config get-contexts -o name 2>/dev/null
|
||||
end
|
||||
|
||||
function __helm_kube_namespaces
|
||||
|
@ -76,11 +76,11 @@ function __helm_kube_namespaces
|
|||
end
|
||||
|
||||
function __helm_releases
|
||||
helm ls --short ^/dev/null
|
||||
helm ls --short 2>/dev/null
|
||||
end
|
||||
|
||||
function __helm_release_completions
|
||||
helm ls ^/dev/null | awk 'NR >= 2 { print $1"\tRelease of "$NF }'
|
||||
helm ls 2>/dev/null | awk 'NR >= 2 { print $1"\tRelease of "$NF }'
|
||||
end
|
||||
|
||||
function __helm_release_revisions
|
||||
|
|
|
@ -34,7 +34,7 @@ function __fish_hg
|
|||
if set -l cwd (__fish_hg_get_cwd)
|
||||
set argv $argv --cwd $cwd
|
||||
end
|
||||
command hg $argv ^ /dev/null
|
||||
command hg $argv 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_hg_commands
|
||||
|
|
|
@ -29,7 +29,7 @@ function __fish_iptables_user_chains
|
|||
set tablearg "--table=$table"
|
||||
end
|
||||
# This only works as root, so ignore errors
|
||||
iptables $tablearg -L ^/dev/null | grep Chain | while read a b c
|
||||
iptables $tablearg -L 2>/dev/null | grep Chain | while read a b c
|
||||
echo $b
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,13 +17,13 @@ end
|
|||
|
||||
function __fish_journalctl_field_values
|
||||
set -l token (commandline -t | cut -d"=" -f 1)
|
||||
command journalctl -F $token ^ /dev/null | while read value
|
||||
command journalctl -F $token 2>/dev/null | while read value
|
||||
echo $token=$value
|
||||
end
|
||||
end
|
||||
|
||||
complete -c journalctl -n "not __fish_journalctl_is_field" -a '(__fish_journalctl_fields)' -d "Journal field" -f
|
||||
complete -c journalctl -n "not __fish_journalctl_is_field" -a '(command journalctl -F _EXE ^/dev/null)' -d "Executable"
|
||||
complete -c journalctl -n "not __fish_journalctl_is_field" -a '(command journalctl -F _EXE 2>/dev/null)' -d "Executable"
|
||||
complete -c journalctl -n "not __fish_journalctl_is_field" -a '+' -d "OR"
|
||||
complete -c journalctl -n "__fish_journalctl_is_field" -a '(__fish_journalctl_field_values)' -f -r
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ end
|
|||
|
||||
complete -c kill -xa '(__fish_complete_pids)'
|
||||
|
||||
if kill -L > /dev/null ^ /dev/null
|
||||
if kill -L > /dev/null 2>/dev/null
|
||||
complete -c kill -s s -l signal -d "Signal to send"
|
||||
complete -c kill -s l -l list -d "Printf list of signal names, or name of given SIG NUMBER"
|
||||
complete -c kill -s L -l table -d " Print signal names and their corresponding numbers"
|
||||
|
|
|
@ -21,7 +21,7 @@ end
|
|||
|
||||
complete -c killall -xa '(__fish_complete_proc)'
|
||||
|
||||
if killall --version >/dev/null ^/dev/null # GNU
|
||||
if killall --version >/dev/null 2>/dev/null # GNU
|
||||
complete -c killall -s e -l exact -d 'Require an exact match for very long names'
|
||||
complete -c killall -s I -l ignore-case -d 'Do case insensitive process name match'
|
||||
complete -c killall -s g -l process-group -d 'Kill the process group to which the process belongs. The kill signal is only sent once per group, even if multiple processes belonging to the same process group were found'
|
||||
|
|
|
@ -17,7 +17,7 @@ complete -c ls -s x -d "List entries by lines"
|
|||
complete -c ls -s 1 -d "List one file per line"
|
||||
|
||||
# Test if we are using GNU ls
|
||||
if command ls --version >/dev/null ^/dev/null
|
||||
if command ls --version >/dev/null 2>/dev/null
|
||||
complete -c ls -s a -l all -d "Show hidden"
|
||||
complete -c ls -s A -l almost-all -d "Show hidden except . and .."
|
||||
complete -c ls -s F -l classify -d "Append filetype indicator"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
complete -c lua -s e -d 'Execute string' -x
|
||||
# Try the most common lib directories, silencing errors in case they don't exist.
|
||||
complete -c lua -s l -d 'Require library' -xa "(find /usr/lib{,32,64}/lua/ -name \*.so -printf '%f\n' ^/dev/null | string replace -r '.so\$' '')"
|
||||
complete -c lua -s l -d 'Require library' -xa "(find /usr/lib{,32,64}/lua/ -name \*.so -printf '%f\n' 2>/dev/null | string replace -r '.so\$' '')"
|
||||
complete -c lua -s i -d 'Enter interactive mode after executing script'
|
||||
complete -c lua -s v -d 'Show version'
|
||||
complete -c lua -s h -l help -d 'Print help and exit'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# Checks if we are using GNU tools
|
||||
if mkdir --version > /dev/null ^ /dev/null
|
||||
if mkdir --version > /dev/null 2>/dev/null
|
||||
complete -c mkdir -l version -d 'Output version'
|
||||
complete -c mkdir -s m -l mode -d 'Set file mode (as in chmod)' -x
|
||||
complete -c mkdir -s p -l parents -d 'Make parent directories as needed'
|
||||
|
@ -14,6 +14,6 @@ else
|
|||
end
|
||||
|
||||
# Checks if SELinux is installed
|
||||
if command -s sestatus > /dev/null ^ /dev/null
|
||||
if command -s sestatus > /dev/null 2>/dev/null
|
||||
complete -c mkdir -l context -s Z -d 'Set SELinux security context of each created directory to the default type'
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if mktemp --version >/dev/null ^/dev/null # GNU
|
||||
if mktemp --version >/dev/null 2>/dev/null # GNU
|
||||
complete -c mktemp -s d -l directory -d 'create a directory, not a file'
|
||||
complete -c mktemp -s u -l dry-run -d 'do not create anything; merely print a name (unsafe)'
|
||||
complete -c mktemp -s q -l quiet -d 'suppress diagnostics about file/dir-creation failure'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if command -s uname > /dev/null ^/dev/null
|
||||
if command -s uname > /dev/null 2>/dev/null
|
||||
if test (uname) = "Linux"
|
||||
complete -c modinfo -a "(__fish_print_modules)"
|
||||
complete -c modinfo -l author -s a -d "Print only 'author'"
|
||||
|
|
|
@ -59,7 +59,7 @@ function __fish_complete_npm -d "Complete the commandline using npm's 'completio
|
|||
set COMP_CWORD (math $COMP_CWORD + 1)
|
||||
set COMP_LINE $COMP_LINE ""
|
||||
end
|
||||
command npm completion -- $COMP_LINE ^/dev/null
|
||||
command npm completion -- $COMP_LINE 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ end
|
|||
|
||||
function __fish_pa_list_ports
|
||||
# Yes, this is localized
|
||||
env LC_ALL=C pactl list cards ^/dev/null | sed -n -e '/Ports:/,$p' | string match -r '^\t\t\w.*$' | string replace -r '\s+([-+\w:]+): (\w.+)' '$1\t$2'
|
||||
env LC_ALL=C pactl list cards 2>/dev/null | sed -n -e '/Ports:/,$p' | string match -r '^\t\t\w.*$' | string replace -r '\s+([-+\w:]+): (\w.+)' '$1\t$2'
|
||||
end
|
||||
|
||||
function __fish_pa_list_profiles
|
||||
env LC_ALL=C pactl list cards ^/dev/null | sed -n -e '/Profiles:/,/Active Profile/p' | string match -r '\t\t.*' | string replace -r '\s+([-+\w:]+): (\w.+)' '$1\t$2'
|
||||
env LC_ALL=C pactl list cards 2>/dev/null | sed -n -e '/Profiles:/,/Active Profile/p' | string match -r '\t\t.*' | string replace -r '\s+([-+\w:]+): (\w.+)' '$1\t$2'
|
||||
end
|
||||
|
||||
# This is needed to filter out loaded modules
|
||||
|
|
|
@ -7,7 +7,7 @@ function __fish_passwd_darwin_infosystem
|
|||
echo -e "nis\tRemote NIS server"
|
||||
end
|
||||
|
||||
if passwd --help >/dev/null ^&1
|
||||
if passwd --help >/dev/null 2>&1
|
||||
complete -c passwd -n '__fish_contains_opt -s S status' -s a -l all -f -d "Display password state for all users"
|
||||
complete -c passwd -s d -l delete -f -d "Delete user password"
|
||||
complete -c passwd -s e -l expire -f -d "Immediately obsolete user password"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
begin
|
||||
set -l unicode 'commandline | string match -qr -- "-[a-zA-Z]*C[a-zA-Z]*\$"'
|
||||
set -l noopt 'commandline | not string match -qr -- "-[a-zA-Z]*C[a-zA-Z]*\$"'
|
||||
set -l modules "(find (perl -lE'print for @INC') -name '*.pm' -printf '%P\n' ^/dev/null \
|
||||
set -l modules "(find (perl -lE'print for @INC') -name '*.pm' -printf '%P\n' 2>/dev/null \
|
||||
| sed -e 's,/,::,g; s,\.pm\$,,' | sort -u)"
|
||||
complete -c perl -s 0 -n $noopt -d 'Specify record separator'
|
||||
complete -c perl -s a -n $noopt -d 'Turn on autosplit mode'
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
function __fish_complete_pg_database
|
||||
psql -AtqwlF \t ^/dev/null | awk 'NF > 1 { print $1 }'
|
||||
psql -AtqwlF \t 2>/dev/null | awk 'NF > 1 { print $1 }'
|
||||
end
|
||||
|
||||
function __fish_complete_pg_user
|
||||
psql -Atqwc 'select usename from pg_user' template1 ^/dev/null
|
||||
psql -Atqwc 'select usename from pg_user' template1 2>/dev/null
|
||||
end
|
||||
|
||||
complete -c psql --no-files -a '(__fish_complete_pg_database)'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#Completions for rm
|
||||
if rm --version >/dev/null ^/dev/null # GNU
|
||||
if rm --version >/dev/null 2>/dev/null # GNU
|
||||
complete -c rm -s d -l directory -d "Unlink directory (Only by superuser)"
|
||||
complete -c rm -s f -l force -d "Never prompt before removal"
|
||||
complete -c rm -s i -l interactive -d "Prompt before removal"
|
||||
|
|
|
@ -130,6 +130,6 @@ complete -c rsync -d "Remote path" -n "commandline -ct | string match -q '*:*'"
|
|||
__rsync_remote_target
|
||||
)(
|
||||
# Get the list of remote files from the specified rsync server.
|
||||
rsync --list-only (__rsync_remote_target) ^/dev/null | string replace -r '^d.*' '\$0/' | tr -s ' ' | cut -d' ' -f 5-
|
||||
rsync --list-only (__rsync_remote_target) 2>/dev/null | string replace -r '^d.*' '\$0/' | tr -s ' ' | cut -d' ' -f 5-
|
||||
)
|
||||
"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Test if we are using GNU sed
|
||||
|
||||
set -l is_gnu
|
||||
sed --version >/dev/null ^/dev/null; and set is_gnu --is-gnu
|
||||
sed --version >/dev/null 2>/dev/null; and set is_gnu --is-gnu
|
||||
|
||||
# Shared ls switches
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if seq --version ^ /dev/null > /dev/null #GNU
|
||||
if seq --version 2>/dev/null > /dev/null #GNU
|
||||
complete -c seq -s f -l format -d 'Use printf style floating-point FORMAT'
|
||||
complete -c seq -s s -l separator -d 'Use STRING to separate numbers'
|
||||
complete -c seq -s w -l equal-width -d 'Equalize width with leading zeroes'
|
||||
|
|
|
@ -19,7 +19,7 @@ complete -c ssh -s a -d "Disables forwarding of the authentication agent"
|
|||
complete -c ssh -s A -d "Enables forwarding of the authentication agent"
|
||||
# TODO: Improve this since /proc/net/arp is not POSIX compliant.
|
||||
complete -x -c ssh -s b -d "Interface to transmit from" -a "
|
||||
(cut -d ' ' -f 1 /proc/net/arp ^/dev/null | string match -r -v '^IP')
|
||||
(cut -d ' ' -f 1 /proc/net/arp 2>/dev/null | string match -r -v '^IP')
|
||||
"
|
||||
|
||||
complete -x -c ssh -s e -d "Escape character" -a "\^ none"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if stat --version ^ /dev/null > /dev/null # GNU
|
||||
if stat --version 2>/dev/null > /dev/null # GNU
|
||||
complete -c stat -s L -l dereference -d 'follow links'
|
||||
complete -c stat -s f -l file-system -d 'display file system status instead of file status'
|
||||
complete -c stat -s c -l format -x -d 'use the specified FORMAT instead of the default; output a newline after each use of FORMAT'
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
if type -q -f sysctl
|
||||
# Only GNU and BSD sysctl seem to know "-h", so others should exit non-zero
|
||||
if sysctl -h >/dev/null ^/dev/null
|
||||
if sysctl -h >/dev/null 2>/dev/null
|
||||
# Print sysctl keys and values, separated by a tab
|
||||
function __fish_sysctl_values
|
||||
sysctl -a ^/dev/null | string replace -a " = " \t
|
||||
sysctl -a 2>/dev/null | string replace -a " = " \t
|
||||
end
|
||||
|
||||
complete -c sysctl -a '(__fish_sysctl_values)' -f
|
||||
|
@ -32,7 +32,7 @@ if type -q -f sysctl
|
|||
else
|
||||
# OSX sysctl
|
||||
function __fish_sysctl_values
|
||||
sysctl -a ^/dev/null | string replace -a ":" \t
|
||||
sysctl -a 2>/dev/null | string replace -a ":" \t
|
||||
end
|
||||
|
||||
complete -c sysctl -a '(__fish_sysctl_values)' -f
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if tail --version > /dev/null ^ /dev/null
|
||||
if tail --version > /dev/null 2>/dev/null
|
||||
complete -c tail -s c -l bytes -x -d 'output the last K bytes; alternatively, use -c +K to output bytes starting with the Kth of each file'
|
||||
complete -c tail -s f -l follow -a 'name descriptor' -d 'output appended data as the file grows; -f -l follow, and --follow=descriptor are equivalent'
|
||||
complete -c tail -s F -d 'same as --follow=name --retry'
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
function __fish_tmux_sessions -d 'available sessions'
|
||||
tmux list-sessions -F "#S #{session_windows} windows created: #{session_created_string} [#{session_width}x#{session_height}]#{session_attached}" | sed 's/0$//;s/1$/ (attached)/' ^/dev/null
|
||||
tmux list-sessions -F "#S #{session_windows} windows created: #{session_created_string} [#{session_width}x#{session_height}]#{session_attached}" | sed 's/0$//;s/1$/ (attached)/' 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_tmux_clients -d 'connected clients'
|
||||
tmux list-clients -F "#{client_tty} #S: Created: #{client_created_string} [#{client_width}x#{client_height} #{client_termname}]" ^/dev/null
|
||||
tmux list-clients -F "#{client_tty} #S: Created: #{client_created_string} [#{client_width}x#{client_height} #{client_termname}]" 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_tmux_panes -d 'window panes'
|
||||
#fully qualified pane names
|
||||
tmux list-panes -F '#S:#W.#P session:window.pane' ^/dev/null
|
||||
tmux list-panes -F '#S:#W.#P session:window.pane' 2>/dev/null
|
||||
|
||||
#panes by themselves
|
||||
tmux list-panes -F '#P pane' ^/dev/null
|
||||
tmux list-panes -F '#P pane' 2>/dev/null
|
||||
|
||||
#windows by themselves
|
||||
tmux list-panes -F '#W window' ^/dev/null
|
||||
tmux list-panes -F '#W window' 2>/dev/null
|
||||
end
|
||||
|
||||
#don't allow dirs in the completion list...
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if touch --version ^ /dev/null > /dev/null # GNU
|
||||
if touch --version 2>/dev/null > /dev/null # GNU
|
||||
complete -c touch -s a -d "Change access time"
|
||||
complete -c touch -s B -l backward -x -d "Set date back"
|
||||
complete -c touch -s c -l no-create -d "Do not create file"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
# Test if we are using GNU tr
|
||||
if command tr --version >/dev/null ^/dev/null
|
||||
if command tr --version >/dev/null 2>/dev/null
|
||||
complete -c tr -x
|
||||
complete -c tr -s c -s C -l complement -d 'use the complement of SET1'
|
||||
complete -c tr -s d -l delete -d 'delete characters in SET1, do not translate'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if uniq --version > /dev/null ^ /dev/null
|
||||
if uniq --version > /dev/null 2>/dev/null
|
||||
complete -c uniq -s c -l count -d "Print number of occurences"
|
||||
complete -c uniq -s d -l repeated -d "Only print duplicates"
|
||||
complete -c uniq -s D -l all-repeated -d "Remove non-duplicate lines" -f -x -a "
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Don't go invoking valgrind unless it is installed
|
||||
|
||||
set -l skin tool
|
||||
if type -q valgrind; and valgrind --version ^/dev/null | string match -qr -- '-2\.[012]\.'
|
||||
if type -q valgrind; and valgrind --version 2>/dev/null | string match -qr -- '-2\.[012]\.'
|
||||
# In older versions of Valgrind, the skin selection option was
|
||||
# '--skin'
|
||||
# But someone decided that it would be fun to change this to
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# Check if vi exists at all ( needed for vi --version )
|
||||
if type -q vi
|
||||
# Check if vi is really vim
|
||||
if vi --version > /dev/null ^ /dev/null
|
||||
if vi --version > /dev/null 2>/dev/null
|
||||
complete -c vi -w vim
|
||||
else
|
||||
complete -c vi -s s -d 'Suppress all interactive user feedback'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if which -v > /dev/null ^ /dev/null # GNU
|
||||
if which -v > /dev/null 2>/dev/null # GNU
|
||||
complete -c which -s a -l all -d "Print all matching executables in PATH, not just the first"
|
||||
complete -c which -s i -l read-alias -d "Read aliases from stdin, reporting matching ones on stdout"
|
||||
complete -c which -l skip-alias -d "Ignore option '--read-alias'"
|
||||
|
|
|
@ -4,7 +4,7 @@ function __fish_complete_lpr_option --description 'Complete lpr option'
|
|||
case '*=*'
|
||||
string split -m1 = -- "$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 " ")
|
||||
for l in (lpoptions -l 2>/dev/null | string match -- "*$opt*" | string replace -r '.*/(.*):\s*(.*)$' '$1 $2' | string split " ")
|
||||
if not set -q descr[1]
|
||||
set descr $l
|
||||
continue
|
||||
|
@ -17,7 +17,7 @@ function __fish_complete_lpr_option --description 'Complete lpr option'
|
|||
echo $opt=$l\t$default$descr
|
||||
end
|
||||
case '*'
|
||||
lpoptions -l ^/dev/null | string replace -r '(.*)/(.*):.*$' '$1=\t$2'
|
||||
lpoptions -l 2>/dev/null | string replace -r '(.*)/(.*):.*$' '$1=\t$2'
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ function __fish_complete_man
|
|||
|
||||
if test -n "$token"
|
||||
# Do the actual search
|
||||
apropos $token ^/dev/null | awk '
|
||||
apropos $token 2>/dev/null | awk '
|
||||
BEGIN { FS="[\t ]- "; OFS="\t"; }
|
||||
# BSD/Darwin
|
||||
/^[^( \t]+\('$section'\)/ {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_complete_subcommand_root -d "Run the __fish_complete_subcommand function using a PATH containing /sbin and /usr/sbin"
|
||||
set -lx -p PATH /sbin /usr/sbin ^/dev/null
|
||||
set -lx -p PATH /sbin /usr/sbin 2>/dev/null
|
||||
__fish_complete_subcommand $argv
|
||||
end
|
||||
|
|
|
@ -93,5 +93,5 @@ function __fish_complete_zfs_rw_properties -d "Completes with ZFS read-write pro
|
|||
echo -e "volmode\t"(_ "How to expose volumes to OS")" (default, geom, dev, none)"
|
||||
end
|
||||
# User properties; the /dev/null redirection masks the possible "no datasets available"
|
||||
zfs list -o all ^/dev/null | head -n 1 | string replace -a -r "\s+" "\n" | string match -e ":" | string lower
|
||||
zfs list -o all 2>/dev/null | head -n 1 | string replace -a -r "\s+" "\n" | string match -e ":" | string lower
|
||||
end
|
||||
|
|
|
@ -133,11 +133,11 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
# c_m_p.py should work with any python version.
|
||||
set -l update_args -B $__fish_data_dir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions'
|
||||
if command -qs python3
|
||||
python3 $update_args >/dev/null ^/dev/null &
|
||||
python3 $update_args >/dev/null 2>/dev/null &
|
||||
else if command -qs python2
|
||||
python2 $update_args >/dev/null ^/dev/null &
|
||||
python2 $update_args >/dev/null 2>/dev/null &
|
||||
else if command -qs python
|
||||
python $update_args >/dev/null ^/dev/null &
|
||||
python $update_args >/dev/null 2>/dev/null &
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -165,14 +165,14 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
function __fish_repaint --on-variable fish_color_cwd --description "Event handler, repaints the prompt when fish_color_cwd changes"
|
||||
if status --is-interactive
|
||||
set -e __fish_prompt_cwd
|
||||
commandline -f repaint ^/dev/null
|
||||
commandline -f repaint 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_repaint_root --on-variable fish_color_cwd_root --description "Event handler, repaints the prompt when fish_color_cwd_root changes"
|
||||
if status --is-interactive
|
||||
set -e __fish_prompt_cwd
|
||||
commandline -f repaint ^/dev/null
|
||||
commandline -f repaint 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -231,13 +231,13 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
set -g fish_bind_mode default
|
||||
if test "$fish_key_bindings" = fish_default_key_bindings
|
||||
# Redirect stderr per #1155
|
||||
fish_default_key_bindings ^/dev/null
|
||||
fish_default_key_bindings 2>/dev/null
|
||||
else
|
||||
eval $fish_key_bindings ^/dev/null
|
||||
eval $fish_key_bindings 2>/dev/null
|
||||
end
|
||||
# Load user key bindings if they are defined
|
||||
if functions --query fish_user_key_bindings >/dev/null
|
||||
fish_user_key_bindings ^/dev/null
|
||||
fish_user_key_bindings 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -326,7 +326,7 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
# it ships with example handlers for bash and zsh, so we'll follow that format
|
||||
else if type -p -q pkgfile
|
||||
function __fish_command_not_found_handler --on-event fish_command_not_found
|
||||
set -l __packages (pkgfile --binaries --verbose -- $argv[1] ^/dev/null)
|
||||
set -l __packages (pkgfile --binaries --verbose -- $argv[1] 2>/dev/null)
|
||||
if test $status -eq 0
|
||||
printf "%s may be found in the following packages:\n" "$argv[1]"
|
||||
printf " %s\n" $__packages
|
||||
|
|
|
@ -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 2>/dev/null | awk -v FS=" +- +" '{
|
||||
split($1, names, ", ");
|
||||
for (name in names)
|
||||
if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) {
|
||||
|
|
|
@ -193,7 +193,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
|
|||
|
||||
set -l svn_remote
|
||||
# get some config options from git-config
|
||||
command git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' ^/dev/null | while read -lz key value
|
||||
command git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | while read -lz key value
|
||||
switch $key
|
||||
case bash.showupstream
|
||||
set show_upstream $value
|
||||
|
@ -241,7 +241,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
|
|||
case svn\*
|
||||
# get the upstream from the 'git-svn-id: …' in a commit message
|
||||
# (git-svn uses essentially the same procedure internally)
|
||||
set -l svn_upstream (git log --first-parent -1 --grep="^git-svn-id: \($svn_url_pattern\)" ^/dev/null)
|
||||
set -l svn_upstream (git log --first-parent -1 --grep="^git-svn-id: \($svn_url_pattern\)" 2>/dev/null)
|
||||
if test (count $svn_upstream) -ne 0
|
||||
echo $svn_upstream[-1] | read -l __ svn_upstream __
|
||||
set svn_upstream (string replace -r '@.*' '' -- $svn_upstream)
|
||||
|
@ -280,7 +280,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
|
|||
end
|
||||
|
||||
# Find how many commits we are ahead/behind our upstream
|
||||
set count (command git rev-list --count --left-right $upstream...HEAD ^/dev/null)
|
||||
set count (command git rev-list --count --left-right $upstream...HEAD 2>/dev/null)
|
||||
|
||||
# calculate the result
|
||||
if test -n "$verbose"
|
||||
|
@ -304,7 +304,7 @@ function __fish_git_prompt_show_upstream --description "Helper function for __fi
|
|||
echo "$prefix$___fish_git_prompt_char_upstream_diverged$ahead-$behind"
|
||||
end
|
||||
if test -n "$count" -a -n "$name"
|
||||
echo " "(command git rev-parse --abbrev-ref "$upstream" ^/dev/null)
|
||||
echo " "(command git rev-parse --abbrev-ref "$upstream" 2>/dev/null)
|
||||
end
|
||||
else if test -n "$informative"
|
||||
echo $count | read -l behind ahead
|
||||
|
@ -339,7 +339,7 @@ function __fish_git_prompt --description "Prompt function for Git"
|
|||
if not command -sq git
|
||||
return 1
|
||||
end
|
||||
set -l repo_info (command git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree HEAD ^/dev/null)
|
||||
set -l repo_info (command git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree HEAD 2>/dev/null)
|
||||
test -n "$repo_info"
|
||||
or return
|
||||
|
||||
|
@ -387,7 +387,7 @@ function __fish_git_prompt --description "Prompt function for Git"
|
|||
if set -q __fish_git_prompt_showuntrackedfiles
|
||||
set -l config (command git config --bool bash.showUntrackedFiles)
|
||||
if test "$config" != false
|
||||
if command git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- '*' >/dev/null ^/dev/null
|
||||
if command git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- '*' >/dev/null 2>/dev/null
|
||||
set u $___fish_git_prompt_char_untrackedfiles
|
||||
end
|
||||
end
|
||||
|
@ -463,7 +463,7 @@ function __fish_git_prompt_staged --description "__fish_git_prompt helper, tells
|
|||
set -l staged
|
||||
|
||||
if test -n "$sha"
|
||||
command git diff-index --cached --quiet HEAD -- ^/dev/null
|
||||
command git diff-index --cached --quiet HEAD -- 2>/dev/null
|
||||
or set staged $___fish_git_prompt_char_stagedstate
|
||||
else
|
||||
set staged $___fish_git_prompt_char_invalidstate
|
||||
|
@ -475,7 +475,7 @@ function __fish_git_prompt_dirty --description "__fish_git_prompt helper, tells
|
|||
set -l dirty
|
||||
|
||||
set -l os
|
||||
command git diff --no-ext-diff --quiet --exit-code ^/dev/null
|
||||
command git diff --no-ext-diff --quiet --exit-code 2>/dev/null
|
||||
set os $status
|
||||
if test $os -ne 0
|
||||
set dirty $___fish_git_prompt_char_dirtystate
|
||||
|
@ -487,7 +487,7 @@ set -g ___fish_git_prompt_status_order stagedstate invalidstate dirtystate untra
|
|||
|
||||
function __fish_git_prompt_informative_status
|
||||
|
||||
set -l changedFiles (command git diff --name-status ^/dev/null | string match -r \\w)
|
||||
set -l changedFiles (command git diff --name-status 2>/dev/null | string match -r \\w)
|
||||
set -l stagedFiles (command git diff --staged --name-status | string match -r \\w)
|
||||
|
||||
set -l x (count $changedFiles)
|
||||
|
@ -501,7 +501,7 @@ function __fish_git_prompt_informative_status
|
|||
set -l info
|
||||
|
||||
# If `math` fails for some reason, assume the state is clean - it's the simpler path
|
||||
set -l state (math $dirtystate + $invalidstate + $stagedstate + $untrackedfiles ^/dev/null)
|
||||
set -l state (math $dirtystate + $invalidstate + $stagedstate + $untrackedfiles 2>/dev/null)
|
||||
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
|
||||
|
@ -549,9 +549,9 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
|
|||
set -l os
|
||||
|
||||
if test -d $git_dir/rebase-merge
|
||||
set branch (cat $git_dir/rebase-merge/head-name ^/dev/null)
|
||||
set step (cat $git_dir/rebase-merge/msgnum ^/dev/null)
|
||||
set total (cat $git_dir/rebase-merge/end ^/dev/null)
|
||||
set branch (cat $git_dir/rebase-merge/head-name 2>/dev/null)
|
||||
set step (cat $git_dir/rebase-merge/msgnum 2>/dev/null)
|
||||
set total (cat $git_dir/rebase-merge/end 2>/dev/null)
|
||||
if test -f $git_dir/rebase-merge/interactive
|
||||
set operation "|REBASE-i"
|
||||
else
|
||||
|
@ -559,10 +559,10 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
|
|||
end
|
||||
else
|
||||
if test -d $git_dir/rebase-apply
|
||||
set step (cat $git_dir/rebase-apply/next ^/dev/null)
|
||||
set total (cat $git_dir/rebase-apply/last ^/dev/null)
|
||||
set step (cat $git_dir/rebase-apply/next 2>/dev/null)
|
||||
set total (cat $git_dir/rebase-apply/last 2>/dev/null)
|
||||
if test -f $git_dir/rebase-apply/rebasing
|
||||
set branch (cat $git_dir/rebase-apply/head-name ^/dev/null)
|
||||
set branch (cat $git_dir/rebase-apply/head-name 2>/dev/null)
|
||||
set operation "|REBASE"
|
||||
else if test -f $git_dir/rebase-apply/applying
|
||||
set operation "|AM"
|
||||
|
@ -585,7 +585,7 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
|
|||
end
|
||||
|
||||
if test -z "$branch"
|
||||
set branch (command git symbolic-ref HEAD ^/dev/null; set os $status)
|
||||
set branch (command git symbolic-ref HEAD 2>/dev/null; set os $status)
|
||||
if test $os -ne 0
|
||||
set detached yes
|
||||
set branch (switch "$__fish_git_prompt_describe_style"
|
||||
|
@ -597,7 +597,7 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
|
|||
command git describe HEAD
|
||||
case default '*'
|
||||
command git describe --tags --exact-match HEAD
|
||||
end ^/dev/null; set os $status)
|
||||
end 2>/dev/null; set os $status)
|
||||
if test $os -ne 0
|
||||
# Shorten the sha ourselves to 8 characters - this should be good for most repositories,
|
||||
# and even for large ones it should be good for most commits
|
||||
|
@ -750,7 +750,7 @@ function __fish_git_prompt_repaint $varargs --description "Event handler, repain
|
|||
end
|
||||
end
|
||||
|
||||
commandline -f repaint ^/dev/null
|
||||
commandline -f repaint 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -771,7 +771,7 @@ function __fish_git_prompt_repaint_color $varargs --description "Event handler,
|
|||
set -e ___fish_git_prompt_color_{$name}_done
|
||||
end
|
||||
end
|
||||
commandline -f repaint ^/dev/null
|
||||
commandline -f repaint 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -782,6 +782,6 @@ end
|
|||
function __fish_git_prompt_repaint_char $varargs --description "Event handler, repaints prompt when any char changes"
|
||||
if status --is-interactive
|
||||
set -e _$argv[3]
|
||||
commandline -f repaint ^/dev/null
|
||||
commandline -f repaint 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,8 +45,8 @@ function __fish_hg_prompt --description 'Write out the hg prompt'
|
|||
end
|
||||
|
||||
# Read branch and bookmark
|
||||
set -l branch (cat $root/branch ^/dev/null; or echo default)
|
||||
if set -l bookmark (cat $root/bookmarks.current ^/dev/null)
|
||||
set -l branch (cat $root/branch 2>/dev/null; or echo default)
|
||||
if set -l bookmark (cat $root/bookmarks.current 2>/dev/null)
|
||||
set branch "$branch|$bookmark"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function __fish_is_git_repository --description 'Check if the current directory is a git repository'
|
||||
git rev-parse --is-inside-work-tree ^/dev/null >/dev/null
|
||||
git rev-parse --is-inside-work-tree 2>/dev/null >/dev/null
|
||||
end
|
||||
|
|
|
@ -13,8 +13,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 2>/dev/null >/dev/null
|
||||
or not kill -L 2>/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)
|
||||
|
|
|
@ -12,11 +12,11 @@ function __fish_man_page
|
|||
# Try "man first-second" and fall back to "man first" if that doesn't work out.
|
||||
set -l maincmd (basename $args[1])
|
||||
if set -q args[2]
|
||||
man "$maincmd-$args[2]" ^/dev/null
|
||||
or man "$maincmd" ^/dev/null
|
||||
man "$maincmd-$args[2]" 2>/dev/null
|
||||
or man "$maincmd" 2>/dev/null
|
||||
or printf \a
|
||||
else
|
||||
man "$maincmd" ^/dev/null
|
||||
man "$maincmd" 2>/dev/null
|
||||
or printf \a
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ function __fish_paginate -d "Paginate the current command using the users defaul
|
|||
|
||||
if commandline -j | string match -q -r -v "$cmd *\$"
|
||||
|
||||
commandline -aj " ^&1 | $cmd;"
|
||||
commandline -aj " 2>&1 | $cmd;"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function __fish_portage_print_available_categories --description 'Print all available categories'
|
||||
cat (__fish_portage_print_repository_paths)/profiles/categories ^ /dev/null
|
||||
cat (__fish_portage_print_repository_paths)/profiles/categories 2>/dev/null
|
||||
end
|
||||
|
|
|
@ -43,9 +43,9 @@ function __fish_print_help --description "Print help message for the specified f
|
|||
set mfish -mfish
|
||||
end
|
||||
if test -e "$__fish_data_dir/man/man1/$item.1"
|
||||
set help (nroff -c -man $mfish -t $rLL "$__fish_data_dir/man/man1/$item.1" ^/dev/null)
|
||||
set help (nroff -c -man $mfish -t $rLL "$__fish_data_dir/man/man1/$item.1" 2>/dev/null)
|
||||
else if test -e "$__fish_data_dir/man/man1/$item.1.gz"
|
||||
set help (gunzip -c "$__fish_data_dir/man/man1/$item.1.gz" ^/dev/null | nroff -c -man $mfish -t $rLL ^/dev/null)
|
||||
set help (gunzip -c "$__fish_data_dir/man/man1/$item.1.gz" 2>/dev/null | nroff -c -man $mfish -t $rLL 2>/dev/null)
|
||||
end
|
||||
|
||||
# The original implementation trimmed off the top 5 lines and bottom 3 lines
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function __fish_print_lpr_options --description 'Print lpr options'
|
||||
lpoptions -l ^/dev/null | sed 's+\(.*\)/\(.*\):.*$+\1\t\2+'
|
||||
lpoptions -l 2>/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 2>/dev/null | sed 's/^\S*\s\(\S*\)\s\(.*\)$/\1\t\2/'
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ function __fish_print_make_targets --argument-names directory file
|
|||
end
|
||||
|
||||
set -l bsd_make
|
||||
if make -C $directory -pn >/dev/null ^/dev/null
|
||||
if make -C $directory -pn >/dev/null 2>/dev/null
|
||||
set bsd_make 0
|
||||
else
|
||||
set bsd_make 1
|
||||
|
@ -25,9 +25,9 @@ function __fish_print_make_targets --argument-names directory file
|
|||
|
||||
if test "$bsd_make" = 0
|
||||
# https://stackoverflow.com/a/26339924
|
||||
make -C "$directory" -f "$file" -pRrq : ^/dev/null | awk -v RS= -F: '/^# Files/,/^# Finished Make data base/ {if ($1 !~ "^[#.]") {print $1}}' ^/dev/null
|
||||
make -C "$directory" -f "$file" -pRrq : 2>/dev/null | awk -v RS= -F: '/^# Files/,/^# Finished Make data base/ {if ($1 !~ "^[#.]") {print $1}}' 2>/dev/null
|
||||
else
|
||||
make -C "$directory" -f "$file" -d g1 -rn >/dev/null ^| awk -F, '/^#\*\*\* Input graph:/,/^$/ {if ($1 !~ "^#... ") {gsub(/# /,"",$1); print $1}}' ^/dev/null
|
||||
make -C "$directory" -f "$file" -d g1 -rn >/dev/null 2>| awk -F, '/^#\*\*\* Input graph:/,/^$/ {if ($1 !~ "^#... ") {gsub(/# /,"",$1); print $1}}' 2>/dev/null
|
||||
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 2>/dev/null | sed -e 's$/.*/\([^/.]*\).*$\1$'
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ function __fish_print_packages
|
|||
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 -ct) ^/dev/null | sed -e 's/$/'\t$package'/'
|
||||
apt-cache --no-generate pkgnames (commandline -ct) 2>/dev/null | sed -e 's/$/'\t$package'/'
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ function __fish_print_service_names -d 'All services known to the system'
|
|||
# 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)
|
||||
else if type -f rc-service 2>/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/*
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function __fish_print_xdg_mimetypes --description 'Print XDG mime types'
|
||||
cat (__fish_print_xdg_applications_directories)/mimeinfo.cache ^/dev/null | string match -v '[MIME Cache]' | string replace = \t
|
||||
cat (__fish_print_xdg_applications_directories)/mimeinfo.cache 2>/dev/null | string match -v '[MIME Cache]' | string replace = \t
|
||||
end
|
||||
|
|
|
@ -96,7 +96,7 @@ function __fish_svn_prompt --description "Prompt function for svn"
|
|||
end
|
||||
|
||||
# make sure that this is a svn repo
|
||||
set -l checkout_info (command svn info ^/dev/null)
|
||||
set -l checkout_info (command svn info 2>/dev/null)
|
||||
if [ $status -ne 0 ]
|
||||
|
||||
return
|
||||
|
|
|
@ -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 ' '
|
||||
systemctl --user list-unit-files --no-legend --type=service 2>/dev/null $argv | cut -f 1 -d ' '
|
||||
systemctl --user list-units --state=loaded --no-legend --type=service 2>/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 ' '
|
||||
systemctl list-unit-files --no-legend --type=service 2>/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 ' '
|
||||
systemctl list-units --state=loaded --no-legend --type=service 2>/dev/null | cut -f 1 -d ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,14 +26,14 @@ function __terlar_git_prompt --description 'Write out the git prompt'
|
|||
if not command -sq git
|
||||
return 1
|
||||
end
|
||||
set -l branch (git rev-parse --abbrev-ref HEAD ^/dev/null)
|
||||
set -l branch (git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||
if test -z $branch
|
||||
return
|
||||
end
|
||||
|
||||
echo -n '|'
|
||||
|
||||
set -l index (git status --porcelain ^/dev/null|cut -c 1-2|sort -u)
|
||||
set -l index (git status --porcelain 2>/dev/null|cut -c 1-2|sort -u)
|
||||
|
||||
if test -z "$index"
|
||||
set_color $fish_color_git_clean
|
||||
|
|
|
@ -15,7 +15,7 @@ function _fish_systemctl --description 'Call systemctl with some options from th
|
|||
set -l args $argv
|
||||
set -l cmdline (commandline -opc) (commandline -ct)
|
||||
set -e cmdline[1]
|
||||
argparse $opts -- $cmdline ^/dev/null
|
||||
argparse $opts -- $cmdline 2>/dev/null
|
||||
or return
|
||||
|
||||
# If no subcommand has been given, return so this can be used as a condition.
|
||||
|
|
|
@ -20,14 +20,14 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
|
|||
# vte-based terms set $TERM = xterm*, but only gained support relatively recently.
|
||||
# From https://bugzilla.gnome.org/show_bug.cgi?id=720821, it appears it was version 0.40.0
|
||||
if set -q VTE_VERSION
|
||||
and test "$VTE_VERSION" -lt 4000 ^/dev/null
|
||||
and test "$VTE_VERSION" -lt 4000 2>/dev/null
|
||||
return
|
||||
end
|
||||
|
||||
# We use the `tput` here just to see if terminfo thinks we can change the cursor.
|
||||
# We cannot use that sequence directly as it's not the correct one for konsole and iTerm,
|
||||
# and because we may want to change the cursor even though terminfo says we can't (tmux).
|
||||
if not tput Ss >/dev/null ^/dev/null
|
||||
if not tput Ss >/dev/null 2>/dev/null
|
||||
# Whitelist tmux...
|
||||
and not begin
|
||||
set -q TMUX
|
||||
|
@ -57,7 +57,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
|
|||
or set -q ITERM_PROFILE
|
||||
or set -q VTE_VERSION # which version is already checked above
|
||||
# If $XTERM_VERSION is undefined, this will return 1 and print an error. Silence it.
|
||||
or test (string replace -r "XTerm\((\d+)\)" '$1' -- $XTERM_VERSION) -ge 280 ^/dev/null
|
||||
or test (string replace -r "XTerm\((\d+)\)" '$1' -- $XTERM_VERSION) -ge 280 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
|||
bind gU upcase-word
|
||||
|
||||
bind J end-of-line delete-char
|
||||
bind K 'man (commandline -t) ^/dev/null; or echo -n \a'
|
||||
bind K 'man (commandline -t) 2>/dev/null; or echo -n \a'
|
||||
|
||||
bind yy kill-whole-line yank
|
||||
bind Y kill-whole-line yank
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Make ls use colors if we are on a system that supports that feature and writing to stdout.
|
||||
#
|
||||
if command ls --version >/dev/null ^/dev/null
|
||||
if command ls --version >/dev/null 2>/dev/null
|
||||
# This appears to be GNU ls.
|
||||
function ls --description "List contents of directory"
|
||||
set -l param --color=auto
|
||||
|
@ -29,7 +29,7 @@ if command ls --version >/dev/null ^/dev/null
|
|||
end
|
||||
end
|
||||
end
|
||||
else if command ls -G / >/dev/null ^/dev/null
|
||||
else if command ls -G / >/dev/null 2>/dev/null
|
||||
# It looks like BSD, OS X and a few more which support colors through the -G switch instead.
|
||||
function ls --description "List contents of directory"
|
||||
command ls -G $argv
|
||||
|
|
|
@ -10,7 +10,7 @@ function nextd --description "Move forward in the directory history"
|
|||
|
||||
set -l times 1
|
||||
if set -q argv[1]
|
||||
if test $argv[1] -ge 0 ^/dev/null
|
||||
if test $argv[1] -ge 0 2>/dev/null
|
||||
set times $argv[1]
|
||||
else
|
||||
printf (_ "%s: The number of positions to skip must be a non-negative integer\n") nextd
|
||||
|
|
|
@ -10,7 +10,7 @@ function prevd --description "Move back in the directory history"
|
|||
|
||||
set -l times 1
|
||||
if set -q argv[1]
|
||||
if test $argv[1] -ge 0 ^/dev/null
|
||||
if test $argv[1] -ge 0 2>/dev/null
|
||||
set times $argv[1]
|
||||
else
|
||||
printf (_ "%s: The number of positions to skip must be a non-negative integer\n") nextd
|
||||
|
|
|
@ -50,7 +50,7 @@ function psub --description "Read from stdin into a file and output the filename
|
|||
# Find unique function name
|
||||
while true
|
||||
set funcname __fish_psub_(random)
|
||||
if not functions $funcname >/dev/null ^/dev/null
|
||||
if not functions $funcname >/dev/null 2>/dev/null
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user