mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Use set -l to force use of a local variable
Bare set overwrites a global/universal variable if it exists.
This commit is contained in:
parent
fe6c76d058
commit
49c5f96470
59 changed files with 152 additions and 146 deletions
|
@ -5,31 +5,31 @@
|
||||||
#
|
#
|
||||||
# Usage: ./diff_profiles.fish profile1.log profile2.log > profile_diff.log
|
# Usage: ./diff_profiles.fish profile1.log profile2.log > profile_diff.log
|
||||||
|
|
||||||
set profile1 (cat $argv[1])
|
set -l profile1 (cat $argv[1])
|
||||||
set profile2 (cat $argv[2])
|
set -l profile2 (cat $argv[2])
|
||||||
|
|
||||||
set line_no 0
|
set -l line_no 0
|
||||||
while set next_line_no (math $line_no + 1) && set -q profile1[$next_line_no] && set -q profile2[$next_line_no]
|
while set -l next_line_no (math $line_no + 1) && set -q profile1[$next_line_no] && set -q profile2[$next_line_no]
|
||||||
set line_no $next_line_no
|
set line_no $next_line_no
|
||||||
|
|
||||||
set line1 $profile1[$line_no]
|
set -l line1 $profile1[$line_no]
|
||||||
set line2 $profile2[$line_no]
|
set -l line2 $profile2[$line_no]
|
||||||
|
|
||||||
if not string match -qr '^\d+\t\d+' $line1
|
if not string match -qr '^\d+\t\d+' $line1
|
||||||
echo $line1
|
echo $line1
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
set results1 (string match -r '^(\d+)\t(\d+)\s+(.*)' $line1)
|
set -l results1 (string match -r '^(\d+)\t(\d+)\s+(.*)' $line1)
|
||||||
set results2 (string match -r '^(\d+)\t(\d+)\s+(.*)' $line2)
|
set -l results2 (string match -r '^(\d+)\t(\d+)\s+(.*)' $line2)
|
||||||
|
|
||||||
# times from both files
|
# times from both files
|
||||||
set time1 $results1[2..3]
|
set -l time1 $results1[2..3]
|
||||||
set time2 $results2[2..3]
|
set -l time2 $results2[2..3]
|
||||||
|
|
||||||
# leftover from both files
|
# leftover from both files
|
||||||
set remainder1 $results1[4]
|
set -l remainder1 $results1[4]
|
||||||
set remainder2 $results2[4]
|
set -l remainder2 $results2[4]
|
||||||
|
|
||||||
if not string match -q -- $remainder1 $remainder2
|
if not string match -q -- $remainder1 $remainder2
|
||||||
echo Mismatch on line $line_no:
|
echo Mismatch on line $line_no:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# for object files in this directory.
|
# for object files in this directory.
|
||||||
# This was written for macOS nm.
|
# This was written for macOS nm.
|
||||||
|
|
||||||
set FISH_SOURCE_DIR $argv[1]
|
set -l FISH_SOURCE_DIR $argv[1]
|
||||||
if not test -d "$FISH_SOURCE_DIR"
|
if not test -d "$FISH_SOURCE_DIR"
|
||||||
echo "FISH_SOURCE_DIR not given"
|
echo "FISH_SOURCE_DIR not given"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -20,8 +20,8 @@ set -g whitelist \
|
||||||
# In our nm regex, we are interested in data (dD) and bss (bB) segments.
|
# In our nm regex, we are interested in data (dD) and bss (bB) segments.
|
||||||
set -g nm_regex '^([^ ]+) ([dDbB])'
|
set -g nm_regex '^([^ ]+) ([dDbB])'
|
||||||
|
|
||||||
set total_globals 0
|
set -l total_globals 0
|
||||||
set boring_files \
|
set -l boring_files \
|
||||||
fish_key_reader.cpp.o \
|
fish_key_reader.cpp.o \
|
||||||
fish_tests.cpp.o \
|
fish_tests.cpp.o \
|
||||||
fish_indent.cpp.o \
|
fish_indent.cpp.o \
|
||||||
|
@ -29,7 +29,7 @@ set boring_files \
|
||||||
|
|
||||||
# return if we should ignore the given symbol name
|
# return if we should ignore the given symbol name
|
||||||
function should_ignore
|
function should_ignore
|
||||||
set symname $argv[1]
|
set -l symname $argv[1]
|
||||||
string match -q '*guard variable for*' $symname
|
string match -q '*guard variable for*' $symname
|
||||||
and return 0
|
and return 0
|
||||||
contains $symname $whitelist
|
contains $symname $whitelist
|
||||||
|
@ -39,16 +39,14 @@ end
|
||||||
|
|
||||||
# echo a cleaned-up symbol name, e.g. replacing template gunk
|
# echo a cleaned-up symbol name, e.g. replacing template gunk
|
||||||
function cleanup_syname
|
function cleanup_syname
|
||||||
set symname $argv[1]
|
set -l symname $argv[1]
|
||||||
set symname (string replace --all 'std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >' 'wcstring' $symname)
|
set symname (string replace --all 'std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >' 'wcstring' $symname)
|
||||||
set symname (string replace --all 'std::__1::vector<wcstring, std::__1::allocator<wcstring > >' 'wcstring_list_t' $symname)
|
set symname (string replace --all 'std::__1::vector<wcstring, std::__1::allocator<wcstring > >' 'wcstring_list_t' $symname)
|
||||||
echo $symname
|
echo $symname
|
||||||
end
|
end
|
||||||
|
|
||||||
# Output the declaration for a symbol name in a given file.
|
# Output the declaration for a symbol name in a given file.
|
||||||
function print_decl
|
function print_decl -a FISH_SOURCE_DIR objfile symname
|
||||||
set -l objfile $argv[1]
|
|
||||||
set -l symname $argv[2]
|
|
||||||
set -l varname (string split '::' $symname)[-1]
|
set -l varname (string split '::' $symname)[-1]
|
||||||
set -l srcfile (basename $objfile .o)
|
set -l srcfile (basename $objfile .o)
|
||||||
set -l srcpath $FISH_SOURCE_DIR/src/$srcfile
|
set -l srcpath $FISH_SOURCE_DIR/src/$srcfile
|
||||||
|
@ -61,7 +59,7 @@ function print_decl
|
||||||
end
|
end
|
||||||
# Guess the variable as the first usage of the name.
|
# Guess the variable as the first usage of the name.
|
||||||
# Strip everything after the first =.
|
# Strip everything after the first =.
|
||||||
set vardecl (egrep -m 1 " $varname\\b" $srcpath | cut -f -1 -d '=' | string trim)
|
set -l vardecl (egrep -m 1 " $varname\\b" $srcpath | cut -f -1 -d '=' | string trim)
|
||||||
if test -z "$vardecl"
|
if test -z "$vardecl"
|
||||||
echo "COULD_NOT_FIND_$varname"
|
echo "COULD_NOT_FIND_$varname"
|
||||||
return 1
|
return 1
|
||||||
|
@ -78,7 +76,7 @@ function decl_is_threadsafe
|
||||||
and return 0
|
and return 0
|
||||||
|
|
||||||
# Ordinary types indicating a safe variable.
|
# Ordinary types indicating a safe variable.
|
||||||
set safes relaxed_atomic_bool_t std::mutex std::condition_variable std::once_flag sig_atomic_t
|
set -l safes relaxed_atomic_bool_t std::mutex std::condition_variable std::once_flag sig_atomic_t
|
||||||
for safe in $safes
|
for safe in $safes
|
||||||
string match -q "*$safe*" $vardecl
|
string match -q "*$safe*" $vardecl
|
||||||
and return 0
|
and return 0
|
||||||
|
@ -93,17 +91,17 @@ function decl_is_threadsafe
|
||||||
end
|
end
|
||||||
|
|
||||||
for file in ./**.o
|
for file in ./**.o
|
||||||
set filename (basename $file)
|
set -l filename (basename $file)
|
||||||
# Skip boring files.
|
# Skip boring files.
|
||||||
contains $filename $boring_files
|
contains $filename $boring_files
|
||||||
and continue
|
and continue
|
||||||
for line in (nm -p -P -U $file | egrep $nm_regex)
|
for line in (nm -p -P -U $file | egrep $nm_regex)
|
||||||
set matches (string match --regex $nm_regex -- $line)
|
set -l matches (string match --regex $nm_regex -- $line)
|
||||||
or continue
|
or continue
|
||||||
set symname (cleanup_syname (echo $matches[2] | c++filt))
|
set -l symname (cleanup_syname (echo $matches[2] | c++filt))
|
||||||
should_ignore $symname
|
should_ignore $symname
|
||||||
and continue
|
and continue
|
||||||
set vardecl (print_decl $filename $symname)
|
set -l vardecl (print_decl $FISH_SOURCE_DIR $filename $symname)
|
||||||
decl_is_threadsafe $vardecl
|
decl_is_threadsafe $vardecl
|
||||||
and continue
|
and continue
|
||||||
echo $filename $symname $matches[3] ":" $vardecl
|
echo $filename $symname $matches[3] ":" $vardecl
|
||||||
|
|
|
@ -16,11 +16,11 @@ xgettext -k -k_ -kN_ -LC++ --no-wrap -o messages.pot src/*.cpp src/*.h
|
||||||
|
|
||||||
# This regex handles descriptions for `complete` and `function` statements. These messages are not
|
# This regex handles descriptions for `complete` and `function` statements. These messages are not
|
||||||
# particularly important to translate. Hence the "implicit" label.
|
# particularly important to translate. Hence the "implicit" label.
|
||||||
set implicit_regex '(?:^| +)(?:complete|function).*? (?:-d|--description) (([\'"]).+?(?<!\\\\)\\2).*'
|
set -l implicit_regex '(?:^| +)(?:complete|function).*? (?:-d|--description) (([\'"]).+?(?<!\\\\)\\2).*'
|
||||||
|
|
||||||
# This regex handles explicit requests to translate a message. These are more important to translate
|
# This regex handles explicit requests to translate a message. These are more important to translate
|
||||||
# than messages which should be implicitly translated.
|
# than messages which should be implicitly translated.
|
||||||
set explicit_regex '.*\( *_ (([\'"]).+?(?<!\\\\)\\2) *\).*'
|
set -l explicit_regex '.*\( *_ (([\'"]).+?(?<!\\\\)\\2) *\).*'
|
||||||
|
|
||||||
rm -r /tmp/fish
|
rm -r /tmp/fish
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
|
|
||||||
# We don't include "missingInclude" as that doesn't find our config.h.
|
# We don't include "missingInclude" as that doesn't find our config.h.
|
||||||
# Missing includes will quickly be found by... compiling the thing anyway.
|
# Missing includes will quickly be found by... compiling the thing anyway.
|
||||||
set cppchecks warning,performance,portability,information #,missingInclude
|
set -l cppchecks warning,performance,portability,information #,missingInclude
|
||||||
set cppcheck_args
|
set -l cppcheck_args
|
||||||
set c_files
|
set -l c_files
|
||||||
set all no
|
set -l all no
|
||||||
set kernel_name (uname -s)
|
set -l kernel_name (uname -s)
|
||||||
set machine_type (uname -m)
|
set -l machine_type (uname -m)
|
||||||
|
|
||||||
argparse a/all p/project= -- $argv
|
argparse a/all p/project= -- $argv
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ else
|
||||||
# We haven't been asked to lint all the source. If there are uncommitted
|
# We haven't been asked to lint all the source. If there are uncommitted
|
||||||
# changes lint those, else lint the files in the most recent commit.
|
# changes lint those, else lint the files in the most recent commit.
|
||||||
# Select (cached files) (modified but not cached, and untracked files)
|
# Select (cached files) (modified but not cached, and untracked files)
|
||||||
set files (git diff-index --cached HEAD --name-only)
|
set -l files (git diff-index --cached HEAD --name-only)
|
||||||
set files $files (git ls-files --exclude-standard --others --modified)
|
set files $files (git ls-files --exclude-standard --others --modified)
|
||||||
if not set -q files[1]
|
if not set -q files[1]
|
||||||
# No pending changes so lint the files in the most recent commit.
|
# No pending changes so lint the files in the most recent commit.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /usr/bin/env fish
|
#! /usr/bin/env fish
|
||||||
|
|
||||||
set TAG $argv[1]
|
set -l TAG $argv[1]
|
||||||
|
|
||||||
if test -z "$TAG"
|
if test -z "$TAG"
|
||||||
echo "Tag name required."
|
echo "Tag name required."
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
# This runs C++ files and fish scripts (*.fish) through their respective code
|
# This runs C++ files and fish scripts (*.fish) through their respective code
|
||||||
# formatting programs.
|
# formatting programs.
|
||||||
#
|
#
|
||||||
set git_clang_format no
|
set -l git_clang_format no
|
||||||
set c_files
|
set -l c_files
|
||||||
set fish_files
|
set -l fish_files
|
||||||
set python_files
|
set -l python_files
|
||||||
set all no
|
set -l all no
|
||||||
|
|
||||||
if test "$argv[1]" = --all
|
if test "$argv[1]" = --all
|
||||||
set all yes
|
set all yes
|
||||||
|
@ -20,7 +20,7 @@ if set -q argv[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
if test $all = yes
|
if test $all = yes
|
||||||
set files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//')
|
set -l files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//')
|
||||||
if set -q files[1]
|
if set -q files[1]
|
||||||
echo
|
echo
|
||||||
echo You have uncommitted changes. Cowardly refusing to restyle the entire code base.
|
echo You have uncommitted changes. Cowardly refusing to restyle the entire code base.
|
||||||
|
@ -34,7 +34,7 @@ else
|
||||||
# We haven't been asked to reformat all the source. If there are uncommitted changes reformat
|
# We haven't been asked to reformat all the source. If there are uncommitted changes reformat
|
||||||
# those using `git clang-format`. Else reformat the files in the most recent commit.
|
# those using `git clang-format`. Else reformat the files in the most recent commit.
|
||||||
# Select (cached files) (modified but not cached, and untracked files)
|
# Select (cached files) (modified but not cached, and untracked files)
|
||||||
set files (git diff-index --cached HEAD --name-only) (git ls-files --exclude-standard --others --modified)
|
set -l files (git diff-index --cached HEAD --name-only) (git ls-files --exclude-standard --others --modified)
|
||||||
if set -q files[1]
|
if set -q files[1]
|
||||||
set git_clang_format yes
|
set git_clang_format yes
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
function __fish_complete_abook_formats --description 'Complete abook formats'
|
function __fish_complete_abook_formats --description 'Complete abook formats'
|
||||||
|
set -l format
|
||||||
abook --formats | while read -l x
|
abook --formats | while read -l x
|
||||||
switch $x
|
switch $x
|
||||||
case "input formats:"
|
case "input formats:"
|
||||||
|
|
|
@ -31,11 +31,12 @@ function __fish_complete_ant_targets -d "Print list of targets from build.xml an
|
||||||
function __get_ant_targets_from_projecthelp -d "Get ant targets from projecthelp"
|
function __get_ant_targets_from_projecthelp -d "Get ant targets from projecthelp"
|
||||||
set -l buildfile $argv[1] # full path to buildfile
|
set -l buildfile $argv[1] # full path to buildfile
|
||||||
|
|
||||||
if [ \( -z "$XDG_CACHE_HOME" \) -o \( ! -d "$XDG_CACHE_HOME" \) ]
|
set -l xdg_cache_home $XDG_CACHE_HOME[1]
|
||||||
set XDG_CACHE_HOME "$HOME/.cache"
|
if [ \( -z $xdg_cache_home \) -o \( ! -d $xdg_cache_home \) ]
|
||||||
|
set xdg_cache_home $HOME/.cache
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l cache_dir "$XDG_CACHE_HOME/fish/ant_completions"
|
set -l cache_dir $xdg_cache_home/fish/ant_completions
|
||||||
mkdir -p $cache_dir
|
mkdir -p $cache_dir
|
||||||
|
|
||||||
set -l cache_file $cache_dir/(__fish_md5 -s $buildfile)
|
set -l cache_file $cache_dir/(__fish_md5 -s $buildfile)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Returns exit code of 0 if apm hasn't received a command yet, e.g. `config`
|
# Returns exit code of 0 if apm hasn't received a command yet, e.g. `config`
|
||||||
function __fish_apm_needs_command
|
function __fish_apm_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if test (count $cmd) -eq 1
|
if test (count $cmd) -eq 1
|
||||||
return 0
|
return 0
|
||||||
else if test (count $cmd) -gt 1
|
else if test (count $cmd) -gt 1
|
||||||
|
@ -20,8 +20,8 @@ end
|
||||||
|
|
||||||
# Returns exit code of 0 if any command (argv[1..-1]) appears once, ignores flags.
|
# Returns exit code of 0 if any command (argv[1..-1]) appears once, ignores flags.
|
||||||
function __fish_apm_using_command
|
function __fish_apm_using_command
|
||||||
set commands $argv
|
set -l commands $argv
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if test (count $cmd) -gt 1
|
if test (count $cmd) -gt 1
|
||||||
set -l command_seen_once 1
|
set -l command_seen_once 1
|
||||||
for c in $cmd[2..-1]
|
for c in $cmd[2..-1]
|
||||||
|
@ -50,7 +50,7 @@ end
|
||||||
|
|
||||||
# Check if `commandline` contains a set of subcommands
|
# Check if `commandline` contains a set of subcommands
|
||||||
function __fish_apm_includes_subcommand
|
function __fish_apm_includes_subcommand
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
for subcommand in $argv
|
for subcommand in $argv
|
||||||
if contains $subcommand $cmd
|
if contains $subcommand $cmd
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
function __fish_complete_apropos
|
function __fish_complete_apropos
|
||||||
if test (commandline -ct)
|
if test (commandline -ct)
|
||||||
set str (commandline -ct)
|
switch (commandline -ct)
|
||||||
switch $str
|
|
||||||
case '-**'
|
case '-**'
|
||||||
|
|
||||||
case '*'
|
case '*'
|
||||||
|
|
|
@ -6,13 +6,13 @@ set -l installed_pkg_subcmds remove
|
||||||
set -l handle_file_pkg_subcmds install
|
set -l handle_file_pkg_subcmds install
|
||||||
|
|
||||||
function __fish_apt_subcommand --no-scope-shadowing
|
function __fish_apt_subcommand --no-scope-shadowing
|
||||||
set subcommand $argv[1]
|
set -l subcommand $argv[1]
|
||||||
set -e argv[1]
|
set -e argv[1]
|
||||||
complete -f -c apt -n "not __fish_seen_subcommand_from $all_subcmds" -a $subcommand $argv
|
complete -f -c apt -n "not __fish_seen_subcommand_from $all_subcmds" -a $subcommand $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_apt_option
|
function __fish_apt_option
|
||||||
set subcommand $argv[1]
|
set -l subcommand $argv[1]
|
||||||
set -e argv[1]
|
set -e argv[1]
|
||||||
complete -f -c apt -n "__fish_seen_subcommand_from $subcommand" $argv
|
complete -f -c apt -n "__fish_seen_subcommand_from $subcommand" $argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# fish completion for arc
|
# fish completion for arc
|
||||||
|
|
||||||
function __fish_arc_needs_command
|
function __fish_arc_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if not set -q cmd[2]
|
if not set -q cmd[2]
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Completion for bundler
|
# Completion for bundler
|
||||||
|
|
||||||
function __fish_bundle_no_command -d 'Test if bundle has been given no subcommand'
|
function __fish_bundle_no_command -d 'Test if bundle has been given no subcommand'
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ function __fish_bundle_no_command -d 'Test if bundle has been given no subcomman
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_bundle_using_command -d 'Test if bundle has been given a specific subcommand'
|
function __fish_bundle_using_command -d 'Test if bundle has been given a specific subcommand'
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function __fish_complete_cabal
|
function __fish_complete_cabal
|
||||||
if type -q -f cabal
|
if type -q -f cabal
|
||||||
set cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
if test (count $cmd) -gt 1
|
if test (count $cmd) -gt 1
|
||||||
cabal $cmd[2..-1] --list-options
|
cabal $cmd[2..-1] --list-options
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
function __fish_canto_using_command
|
function __fish_canto_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_composer_needs_command
|
function __fish_composer_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
|
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
|
@ -9,7 +9,7 @@ function __fish_composer_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_composer_using_command
|
function __fish_composer_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
|
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
|
|
|
@ -566,7 +566,7 @@ git config -z --get-regexp 'alias\..*' | while read -lz alias command _
|
||||||
# so we skip them here.
|
# so we skip them here.
|
||||||
string match -q '!*' -- $command; and continue
|
string match -q '!*' -- $command; and continue
|
||||||
# Git aliases can contain chars that variable names can't - escape them.
|
# Git aliases can contain chars that variable names can't - escape them.
|
||||||
set alias (string replace 'alias.' '' -- $alias | string escape --style=var)
|
set -l alias (string replace 'alias.' '' -- $alias | string escape --style=var)
|
||||||
set -g __fish_git_alias_$alias $command
|
set -g __fish_git_alias_$alias $command
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ function __fish_git_using_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_git_stash_using_command
|
function __fish_git_stash_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
__fish_git_using_command stash
|
__fish_git_using_command stash
|
||||||
or return 2
|
or return 2
|
||||||
# The word after the stash command _must_ be the subcommand
|
# The word after the stash command _must_ be the subcommand
|
||||||
|
@ -600,7 +600,7 @@ function __fish_git_stash_using_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_git_stash_not_using_subcommand
|
function __fish_git_stash_not_using_subcommand
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
__fish_git_using_command stash
|
__fish_git_using_command stash
|
||||||
or return 2
|
or return 2
|
||||||
set cmd $cmd[(contains -i -- "stash" $cmd)..-1]
|
set cmd $cmd[(contains -i -- "stash" $cmd)..-1]
|
||||||
|
|
|
@ -6,14 +6,15 @@ function __fish_gradle_contains_build_file
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_gradle_create_completion_cache_file
|
function __fish_gradle_create_completion_cache_file
|
||||||
|
set -l xdg_cache_home $XDG_CACHE_HOME
|
||||||
# Set up cache directory
|
# Set up cache directory
|
||||||
if test -z "$XDG_CACHE_HOME"
|
if test -z "$xdg_cache_home"
|
||||||
set XDG_CACHE_HOME $HOME/.cache
|
set xdg_cache_home $HOME/.cache
|
||||||
end
|
end
|
||||||
mkdir -m 700 -p "$XDG_CACHE_HOME/gradle-completions"
|
mkdir -m 700 -p "$xdg_cache_home/gradle-completions"
|
||||||
|
|
||||||
set -l md5Hash (__fish_md5 -s $argv[1] | string replace -r '.* = ' '')
|
set -l md5Hash (__fish_md5 -s $argv[1] | string replace -r '.* = ' '')
|
||||||
string trim -- "$XDG_CACHE_HOME/gradle-completions/$md5Hash"
|
string trim -- "$xdg_cache_home/gradle-completions/$md5Hash"
|
||||||
end
|
end
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
|
|
|
@ -30,7 +30,7 @@ function __fish_list_heroku_releases
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_heroku_needs_command
|
function __fish_heroku_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -38,7 +38,7 @@ function __fish_heroku_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_heroku_using_command
|
function __fish_heroku_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -7,7 +7,7 @@ function __fish_print_debian_services --description 'Prints services installed'
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_invoke_rcd_has_service
|
function __fish_invoke_rcd_has_service
|
||||||
set tokens (commandline -opc)
|
set -l tokens (commandline -opc)
|
||||||
if [ (count $tokens) -eq 2 ]
|
if [ (count $tokens) -eq 2 ]
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Check if command already given
|
# Check if command already given
|
||||||
function __fish_prog_needs_command
|
function __fish_prog_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
echo $cmd
|
echo $cmd
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_lein_needs_command
|
function __fish_lein_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -32,4 +32,4 @@ complete -f -c lein -n __fish_lein_needs_command -a uberjar -d "Package up the p
|
||||||
complete -f -c lein -n __fish_lein_needs_command -a update-in -d "Perform arbitrary transformations on your project map."
|
complete -f -c lein -n __fish_lein_needs_command -a update-in -d "Perform arbitrary transformations on your project map."
|
||||||
complete -f -c lein -n __fish_lein_needs_command -a upgrade -d "Upgrade Leiningen to specified version or latest stable."
|
complete -f -c lein -n __fish_lein_needs_command -a upgrade -d "Upgrade Leiningen to specified version or latest stable."
|
||||||
complete -f -c lein -n __fish_lein_needs_command -a version -d "Print version for Leiningen and the current JVM."
|
complete -f -c lein -n __fish_lein_needs_command -a version -d "Print version for Leiningen and the current JVM."
|
||||||
complete -f -c lein -n __fish_lein_needs_command -a with-profile -d "Apply the given task with the profile(s) specified."
|
complete -f -c lein -n __fish_lein_needs_command -a with-profile -d "Apply the given task with the profile(s) specified."
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_lunchy_needs_command
|
function __fish_lunchy_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
|
|
||||||
if test (count $cmd) -eq 1
|
if test (count $cmd) -eq 1
|
||||||
return 0
|
return 0
|
||||||
|
@ -9,8 +9,8 @@ function __fish_lunchy_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_lunchy_using_command
|
function __fish_lunchy_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
set cmd_count (count $cmd)
|
set -l cmd_count (count $cmd)
|
||||||
|
|
||||||
if test $cmd_count -lt 2
|
if test $cmd_count -lt 2
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -13,7 +13,7 @@ function __minikube_no_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __minikube_using_command
|
function __minikube_using_command
|
||||||
set cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
|
|
||||||
if test (count $cmd) -gt (count $argv)
|
if test (count $cmd) -gt (count $argv)
|
||||||
set -e cmd[1]
|
set -e cmd[1]
|
||||||
|
@ -25,8 +25,8 @@ function __minikube_using_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __minikube_using_option
|
function __minikube_using_option
|
||||||
set cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
set query "("(string join -- "|" (string escape --style=regex $argv))")"
|
set -l query "("(string join -- "|" (string escape --style=regex $argv))")"
|
||||||
|
|
||||||
if test (count $cmd) -gt 1
|
if test (count $cmd) -gt 1
|
||||||
if string match -qr -- $query $cmd[-1]
|
if string match -qr -- $query $cmd[-1]
|
||||||
|
@ -37,7 +37,7 @@ function __minikube_using_option
|
||||||
end
|
end
|
||||||
|
|
||||||
function __minikube_using_option_value -a option -a value
|
function __minikube_using_option_value -a option -a value
|
||||||
set cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
|
|
||||||
if test (count $cmd) -gt 1
|
if test (count $cmd) -gt 1
|
||||||
string match -qr -- (string escape --style=regex $option)"[= ]"(string escape --style=regex $value) "$cmd"
|
string match -qr -- (string escape --style=regex $option)"[= ]"(string escape --style=regex $value) "$cmd"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Completions for the Elixir build tool mix
|
# Completions for the Elixir build tool mix
|
||||||
|
|
||||||
function __fish_mix_needs_command
|
function __fish_mix_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ function __fish_mix_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_mix_using_command
|
function __fish_mix_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -8,7 +8,7 @@ source $__fish_data_dir/functions/__fish_npm_helper.fish
|
||||||
set -l npm_install "npm install --global"
|
set -l npm_install "npm install --global"
|
||||||
|
|
||||||
function __fish_npm_needs_command
|
function __fish_npm_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
|
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
|
@ -18,7 +18,7 @@ function __fish_npm_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_npm_using_command
|
function __fish_npm_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
|
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_opam_using_command
|
function __fish_opam_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
@ -9,7 +9,7 @@ function __fish_opam_using_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_opam_at_color
|
function __fish_opam_at_color
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 2 ]
|
if [ (count $cmd) -gt 2 ]
|
||||||
if [ $cmd[-1] = --color ]
|
if [ $cmd[-1] = --color ]
|
||||||
return 0
|
return 0
|
||||||
|
@ -19,7 +19,7 @@ function __fish_opam_at_color
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_opam_needs_command
|
function __fish_opam_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ if passwd --help >/dev/null 2>&1
|
||||||
complete -c passwd -s w -l warndays -x -d "Define maximum period of password validity"
|
complete -c passwd -s w -l warndays -x -d "Define maximum period of password validity"
|
||||||
complete -c passwd -n '__fish_not_contain_opt -s A all' -f -a '(__fish_complete_users)' -d "Account to be altered"
|
complete -c passwd -n '__fish_not_contain_opt -s A all' -f -a '(__fish_complete_users)' -d "Account to be altered"
|
||||||
else # Not Linux, so let's see what it is, with the ugly uname
|
else # Not Linux, so let's see what it is, with the ugly uname
|
||||||
set os_type (uname)
|
set -l os_type (uname)
|
||||||
switch $os_type
|
switch $os_type
|
||||||
case Darwin # macOS family
|
case Darwin # macOS family
|
||||||
complete -c passwd -f -a '(__fish_complete_users)' -d "Account to be altered"
|
complete -c passwd -f -a '(__fish_complete_users)' -d "Account to be altered"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# fish completion for pyenv
|
# fish completion for pyenv
|
||||||
|
|
||||||
function __fish_pyenv_needs_command
|
function __fish_pyenv_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ function __fish_pyenv_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_pyenv_using_command
|
function __fish_pyenv_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# fish completion for rbenv
|
# fish completion for rbenv
|
||||||
|
|
||||||
function __fish_rbenv_needs_command
|
function __fish_rbenv_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@ function __fish_rbenv_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_rbenv_using_command
|
function __fish_rbenv_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_ruby-build_needs_command
|
function __fish_ruby-build_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,8 +26,8 @@ set -l rust_docs (rustc -C help \
|
||||||
| string match -r '^.*[^:]$')
|
| string match -r '^.*[^:]$')
|
||||||
|
|
||||||
for line in $rust_docs
|
for line in $rust_docs
|
||||||
set docs (string split -m 1 ' ' $line)
|
set -l docs (string split -m 1 ' ' $line)
|
||||||
set flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
|
set -l flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
|
||||||
$docs[1])
|
$docs[1])
|
||||||
complete -c rustc -x -s C -l codegen -a (string escape -- "$flag") -d "$docs[2]"
|
complete -c rustc -x -s C -l codegen -a (string escape -- "$flag") -d "$docs[2]"
|
||||||
end
|
end
|
||||||
|
@ -40,8 +40,8 @@ if rustc +nightly >/dev/null 2>&1
|
||||||
| string match -r '^.*[^:]$')
|
| string match -r '^.*[^:]$')
|
||||||
|
|
||||||
for line in $rust_docs
|
for line in $rust_docs
|
||||||
set docs (string split -m 1 ' ' $line)
|
set -l docs (string split -m 1 ' ' $line)
|
||||||
set flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
|
set -l flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
|
||||||
$docs[1])
|
$docs[1])
|
||||||
complete -c rustc -x -s Z -a (string escape -- "$flag") -d "$docs[2]"
|
complete -c rustc -x -s Z -a (string escape -- "$flag") -d "$docs[2]"
|
||||||
end
|
end
|
||||||
|
@ -57,7 +57,7 @@ set -l rust_docs (rustc -W help \
|
||||||
| string match -r -v '^([a-z\-]+)(\s+)(allow|warn|deny|forbid)')
|
| string match -r -v '^([a-z\-]+)(\s+)(allow|warn|deny|forbid)')
|
||||||
|
|
||||||
for line in $rust_docs
|
for line in $rust_docs
|
||||||
set docs (string split -m 1 ' ' $line)
|
set -l docs (string split -m 1 ' ' $line)
|
||||||
complete -c rustc -x -s W -l warn -a (string escape -- "$docs[1]") -d "$docs[2]"
|
complete -c rustc -x -s W -l warn -a (string escape -- "$docs[1]") -d "$docs[2]"
|
||||||
complete -c rustc -x -s A -l allow -a (string escape -- "$docs[1]") -d "$docs[2]"
|
complete -c rustc -x -s A -l allow -a (string escape -- "$docs[1]") -d "$docs[2]"
|
||||||
complete -c rustc -x -s D -l deny -a (string escape -- "$docs[1]") -d "$docs[2]"
|
complete -c rustc -x -s D -l deny -a (string escape -- "$docs[1]") -d "$docs[2]"
|
||||||
|
|
|
@ -161,7 +161,7 @@ function __rustup_common_suffix
|
||||||
set -l suffix
|
set -l suffix
|
||||||
set -l done 0
|
set -l done 0
|
||||||
while test $done -eq 0 -a $length -le $min_length
|
while test $done -eq 0 -a $length -le $min_length
|
||||||
set match (string match -r -- ".{$length}\$" "$argv[1]")
|
set -l match (string match -r -- ".{$length}\$" "$argv[1]")
|
||||||
for arg in $argv[2..-1]
|
for arg in $argv[2..-1]
|
||||||
set -l value (string match -r -- ".{$length}\$" "$arg")
|
set -l value (string match -r -- ".{$length}\$" "$arg")
|
||||||
if test "$value" = "$match"
|
if test "$value" = "$match"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_detect_screen_socket_dir -d "Detect which folder screen uses"
|
function __fish_detect_screen_socket_dir -d "Detect which folder screen uses"
|
||||||
set screen_bin screen
|
set -l screen_bin screen
|
||||||
if not set -q __fish_screen_socket_dir
|
if not set -q __fish_screen_socket_dir
|
||||||
set -g __fish_screen_socket_dir ($screen_bin -ls __fish_i_don_t_think_this_will_be_matched | string match -r "(?<=No Sockets found in ).*(?=\.)")
|
set -g __fish_screen_socket_dir ($screen_bin -ls __fish_i_don_t_think_this_will_be_matched | string match -r "(?<=No Sockets found in ).*(?=\.)")
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ set -g __fish_locale_vars LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETAR
|
||||||
#
|
#
|
||||||
|
|
||||||
function __fish_set_is_color -d 'Test if We are specifying a color value for the prompt'
|
function __fish_set_is_color -d 'Test if We are specifying a color value for the prompt'
|
||||||
set cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
set -e cmd[1]
|
set -e cmd[1]
|
||||||
for i in $cmd
|
for i in $cmd
|
||||||
switch $i
|
switch $i
|
||||||
|
@ -31,7 +31,7 @@ function __fish_set_is_color -d 'Test if We are specifying a color value for the
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_set_is_locale -d 'Test if We are specifying a locale value for the prompt'
|
function __fish_set_is_locale -d 'Test if We are specifying a locale value for the prompt'
|
||||||
set cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
set -e cmd[1]
|
set -e cmd[1]
|
||||||
for i in $cmd
|
for i in $cmd
|
||||||
switch $i
|
switch $i
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Tab completion for sfdx (https://developer.salesforce.com/tools/sfdxcli).
|
# Tab completion for sfdx (https://developer.salesforce.com/tools/sfdxcli).
|
||||||
|
|
||||||
function __fish_sfdx_using_command
|
function __fish_sfdx_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -39,13 +39,13 @@ function __fish_snap_use_file -d 'Test if snap command should have files as pote
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_snap_subcommand
|
function __fish_snap_subcommand
|
||||||
set subcommand $argv[1]
|
set -l subcommand $argv[1]
|
||||||
set -e argv[1]
|
set -e argv[1]
|
||||||
complete -f -c snap -n __fish_snap_no_subcommand -a $subcommand $argv
|
complete -f -c snap -n __fish_snap_no_subcommand -a $subcommand $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_snap_option
|
function __fish_snap_option
|
||||||
set subcommand $argv[1]
|
set -l subcommand $argv[1]
|
||||||
set -e argv[1]
|
set -e argv[1]
|
||||||
complete -f -c snap -n "__fish_snap_using_subcommand $subcommand" $argv
|
complete -f -c snap -n "__fish_snap_using_subcommand $subcommand" $argv
|
||||||
end
|
end
|
||||||
|
@ -99,7 +99,7 @@ function __fish_snap_using_assertion -d 'Check if certain assertion type is used
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_snap_assertion
|
function __fish_snap_assertion
|
||||||
set assertion $argv[1]
|
set -l assertion $argv[1]
|
||||||
set -e argv[1]
|
set -e argv[1]
|
||||||
complete -f -c snap -n '__fish_snap_using_subcommand known; and __fish_snap_no_assertion' -a $assertion
|
complete -f -c snap -n '__fish_snap_using_subcommand known; and __fish_snap_no_assertion' -a $assertion
|
||||||
complete -f -c snap -n "__fish_snap_using_assertion $assertion" -a "(__fish_snap_filters $assertion)"\
|
complete -f -c snap -n "__fish_snap_using_assertion $assertion" -a "(__fish_snap_filters $assertion)"\
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_tmuxinator_using_command
|
function __fish_tmuxinator_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_travis_needs_command
|
function __fish_travis_needs_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -eq 1 ]
|
if [ (count $cmd) -eq 1 ]
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@ function __fish_travis_needs_command
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_travis_using_command
|
function __fish_travis_using_command
|
||||||
set cmd (commandline -opc)
|
set -l cmd (commandline -opc)
|
||||||
if [ (count $cmd) -gt 1 ]
|
if [ (count $cmd) -gt 1 ]
|
||||||
if [ $argv[1] = $cmd[2] ]
|
if [ $argv[1] = $cmd[2] ]
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
function __fish_get_vmctl_vms
|
function __fish_get_vmctl_vms
|
||||||
for line in (vmctl status | string match -e -v "MAXMEM")
|
for line in (vmctl status | string match -e -v "MAXMEM")
|
||||||
set a (string split " " $line)
|
set -l a (string split " " $line)
|
||||||
and printf "%s " $a[-1]
|
and printf "%s " $a[-1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --argument cfgfiles
|
function __fish_complete_wvdial_peers --description 'Complete wvdial peers' --argument cfgfiles
|
||||||
set -q cfgfiles[0]
|
set -q cfgfiles[1]
|
||||||
or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc
|
or set -l cfgfiles /etc/wvdial.conf ~/.wvdialrc
|
||||||
|
|
||||||
# test if there is an alternative config file specified
|
# test if there is an alternative config file specified
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# - for eligible commands, with arguments of different types, only propose second type completions after the first have been selected; for instance, only propose pool members for offline command
|
# - for eligible commands, with arguments of different types, only propose second type completions after the first have been selected; for instance, only propose pool members for offline command
|
||||||
# - this has been written mainly from manpages, which are known to be out-of-sync with the real feature set; some discrepancies have been addressed, but it is highly likely that others still lie
|
# - this has been written mainly from manpages, which are known to be out-of-sync with the real feature set; some discrepancies have been addressed, but it is highly likely that others still lie
|
||||||
|
|
||||||
set OS ""
|
set -lx OS ""
|
||||||
switch (uname)
|
switch (uname)
|
||||||
case Linux
|
case Linux
|
||||||
set OS Linux
|
set OS Linux
|
||||||
|
|
|
@ -43,7 +43,7 @@ function __fish_zypper_print_repos
|
||||||
# Because spaces and special characters are allowed in repo aliases (bad
|
# Because spaces and special characters are allowed in repo aliases (bad
|
||||||
# practice though, but allowed), it's impossible to parse the aliases from
|
# practice though, but allowed), it's impossible to parse the aliases from
|
||||||
# zypper's output correctly. So we fetch them from the repo files.
|
# zypper's output correctly. So we fetch them from the repo files.
|
||||||
set repos (cat /etc/zypp/repos.d/*.repo | string replace -rf '^\[(.+)\]$' '$1')
|
set -l repos (cat /etc/zypp/repos.d/*.repo | string replace -rf '^\[(.+)\]$' '$1')
|
||||||
# Then use the aliases to match their names from zypper's output.
|
# Then use the aliases to match their names from zypper's output.
|
||||||
string replace -rf '^[\d\s]+\| ('(string escape -n $repos | string join \|)') +\| (.+)\s+\|.*\|.*\|.*$' '$1\t$2' -- $zypper_lr
|
string replace -rf '^[\d\s]+\| ('(string escape -n $repos | string join \|)') +\| (.+)\s+\|.*\|.*\|.*$' '$1\t$2' -- $zypper_lr
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_co
|
||||||
case "uid*"
|
case "uid*"
|
||||||
# Extract user ids (note: gpg escapes colons as '\x3a')
|
# Extract user ids (note: gpg escapes colons as '\x3a')
|
||||||
set -l __uid (string split ":" -- $garbage)
|
set -l __uid (string split ":" -- $garbage)
|
||||||
set uid (string replace -a '\x3a' ':' -- $__uuid[10])
|
set -l uid (string replace -a '\x3a' ':' -- $__uuid[10])
|
||||||
printf "%s\t%s\n" $keyid $uid
|
printf "%s\t%s\n" $keyid $uid
|
||||||
case "pub*"
|
case "pub*"
|
||||||
# Extract key fingerprints (no subkeys)
|
# Extract key fingerprints (no subkeys)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function __fish_gnu_complete -d "Wrapper for the complete built-in. Skips the long completions on non-GNU systems"
|
function __fish_gnu_complete -d "Wrapper for the complete built-in. Skips the long completions on non-GNU systems"
|
||||||
set is_gnu 0
|
set -l is_gnu 0
|
||||||
|
|
||||||
set -l argv_out
|
set -l argv_out
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
|
function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
|
||||||
set cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
set -e cmd[1]
|
set -e cmd[1]
|
||||||
for i in $cmd
|
for i in $cmd
|
||||||
switch $i
|
switch $i
|
||||||
|
|
|
@ -14,7 +14,7 @@ function __fish_move_last -d "Move the last element of a directory history from
|
||||||
# Append current dir to the end of the destination
|
# Append current dir to the end of the destination
|
||||||
set -g (echo $dest) $$dest $PWD
|
set -g (echo $dest) $$dest $PWD
|
||||||
|
|
||||||
set ssrc $$src
|
set -l ssrc $$src
|
||||||
|
|
||||||
# Change dir to the last entry in the source dir-hist
|
# Change dir to the last entry in the source dir-hist
|
||||||
builtin cd $ssrc[$size_src]
|
builtin cd $ssrc[$size_src]
|
||||||
|
|
|
@ -53,19 +53,20 @@ function __fish_print_packages
|
||||||
### BEGIN CACHED RESULTS ###
|
### BEGIN CACHED RESULTS ###
|
||||||
|
|
||||||
# Set up cache directory
|
# Set up cache directory
|
||||||
if test -z "$XDG_CACHE_HOME"
|
set -l xdg_cache_home $XDG_CACHE_HOME
|
||||||
set XDG_CACHE_HOME $HOME/.cache
|
if test -z "$xdg_cache_home"
|
||||||
|
set xdg_cache_home $HOME/.cache
|
||||||
end
|
end
|
||||||
mkdir -m 700 -p $XDG_CACHE_HOME
|
mkdir -m 700 -p $xdg_cache_home
|
||||||
|
|
||||||
# Caches for 5 minutes
|
# Caches for 5 minutes
|
||||||
if type -q -f pacman
|
if type -q -f pacman
|
||||||
if not set -q only_installed
|
if not set -q only_installed
|
||||||
set cache_file $XDG_CACHE_HOME/.pac-cache.$USER
|
set -l cache_file $xdg_cache_home/.pac-cache.$USER
|
||||||
if test -f $cache_file
|
if test -f $cache_file
|
||||||
cat $cache_file
|
cat $cache_file
|
||||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
set max_age 250
|
set -l max_age 250
|
||||||
if test $age -lt $max_age
|
if test $age -lt $max_age
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -89,7 +90,7 @@ function __fish_print_packages
|
||||||
|
|
||||||
# If the cache is less than five minutes old, we do not recalculate it
|
# If the cache is less than five minutes old, we do not recalculate it
|
||||||
|
|
||||||
set -l cache_file $XDG_CACHE_HOME/.zypper-cache.$USER
|
set -l cache_file $xdg_cache_home/.zypper-cache.$USER
|
||||||
if test -f $cache_file
|
if test -f $cache_file
|
||||||
cat $cache_file
|
cat $cache_file
|
||||||
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
set -l age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
|
@ -109,7 +110,7 @@ function __fish_print_packages
|
||||||
|
|
||||||
# If the cache is less than six hours old, we do not recalculate it
|
# If the cache is less than six hours old, we do not recalculate it
|
||||||
|
|
||||||
set cache_file $XDG_CACHE_HOME/.yum-cache.$USER
|
set -l cache_file $xdg_cache_home/.yum-cache.$USER
|
||||||
if test -f $cache_file
|
if test -f $cache_file
|
||||||
cat $cache_file
|
cat $cache_file
|
||||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
|
@ -131,7 +132,7 @@ function __fish_print_packages
|
||||||
|
|
||||||
# If the cache is less than five minutes old, we do not recalculate it
|
# If the cache is less than five minutes old, we do not recalculate it
|
||||||
|
|
||||||
set cache_file $XDG_CACHE_HOME/.rpm-cache.$USER
|
set -l cache_file $xdg_cache_home/.rpm-cache.$USER
|
||||||
if test -f $cache_file
|
if test -f $cache_file
|
||||||
cat $cache_file
|
cat $cache_file
|
||||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
|
@ -154,7 +155,7 @@ function __fish_print_packages
|
||||||
# Determine whether to print installed/available packages
|
# Determine whether to print installed/available packages
|
||||||
|
|
||||||
if set -q only_installed
|
if set -q only_installed
|
||||||
set cache_file $XDG_CACHE_HOME/.eopkg-installed-cache.$USER
|
set -l cache_file $xdg_cache_home/.eopkg-installed-cache.$USER
|
||||||
if test -f $cache_file
|
if test -f $cache_file
|
||||||
cat $cache_file
|
cat $cache_file
|
||||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
|
@ -168,7 +169,7 @@ function __fish_print_packages
|
||||||
eopkg list-installed -N | cut -d ' ' -f 1 >$cache_file &
|
eopkg list-installed -N | cut -d ' ' -f 1 >$cache_file &
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
set cache_file $XDG_CACHE_HOME/.eopkg-available-cache.$USER
|
set -l cache_file $xdg_cache_home/.eopkg-available-cache.$USER
|
||||||
if test -f $cache_file
|
if test -f $cache_file
|
||||||
cat $cache_file
|
cat $cache_file
|
||||||
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
set age (math (date +%s) - (stat -c '%Y' $cache_file))
|
||||||
|
@ -205,7 +206,7 @@ function __fish_print_packages
|
||||||
# don't save unix time, but the actual date. Also BSD stat is vastly
|
# don't save unix time, but the actual date. Also BSD stat is vastly
|
||||||
# different from linux stat and converting its time format is tedious
|
# different from linux stat and converting its time format is tedious
|
||||||
if type -q -f port
|
if type -q -f port
|
||||||
set cache_file $XDG_CACHE_HOME/.port-cache.$USER
|
set -l cache_file $xdg_cache_home/.port-cache.$USER
|
||||||
if test -e $cache_file
|
if test -e $cache_file
|
||||||
# Delete if cache is older than 15 minutes
|
# Delete if cache is older than 15 minutes
|
||||||
find "$cache_file" -ctime +15m | awk '{$1=$1;print}' | xargs rm
|
find "$cache_file" -ctime +15m | awk '{$1=$1;print}' | xargs rm
|
||||||
|
|
|
@ -15,8 +15,8 @@ function down-or-search -d "Depending on cursor position and current mode, eithe
|
||||||
# We are not already in search mode.
|
# We are not already in search mode.
|
||||||
# If we are on the bottom line, start search mode,
|
# If we are on the bottom line, start search mode,
|
||||||
# otherwise move down
|
# otherwise move down
|
||||||
set lineno (commandline -L)
|
set -l lineno (commandline -L)
|
||||||
set line_count (count (commandline))
|
set -l line_count (count (commandline))
|
||||||
|
|
||||||
switch $lineno
|
switch $lineno
|
||||||
case $line_count
|
case $line_count
|
||||||
|
|
|
@ -26,7 +26,7 @@ function funced --description 'Edit function definition'
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
set funcname $argv[1]
|
set -l funcname $argv[1]
|
||||||
|
|
||||||
# Check VISUAL first since theoretically EDITOR could be ed.
|
# Check VISUAL first since theoretically EDITOR could be ed.
|
||||||
set -l editor
|
set -l editor
|
||||||
|
|
|
@ -13,7 +13,7 @@ function prompt_pwd --description "Print the current working directory, shortene
|
||||||
or set -l fish_prompt_pwd_dir_length 1
|
or set -l fish_prompt_pwd_dir_length 1
|
||||||
|
|
||||||
# Replace $HOME with "~"
|
# Replace $HOME with "~"
|
||||||
set realhome ~
|
set -l realhome ~
|
||||||
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
|
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
|
||||||
|
|
||||||
if [ $fish_prompt_pwd_dir_length -eq 0 ]
|
if [ $fish_prompt_pwd_dir_length -eq 0 ]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# This defines a compatibility shim for the `trap` command found in other shells like bash and zsh.
|
# This defines a compatibility shim for the `trap` command found in other shells like bash and zsh.
|
||||||
|
|
||||||
function __trap_translate_signal
|
function __trap_translate_signal
|
||||||
set upper (echo $argv[1]|tr a-z A-Z)
|
set -l upper (echo $argv[1]|tr a-z A-Z)
|
||||||
string replace -r '^SIG' '' -- $upper
|
string replace -r '^SIG' '' -- $upper
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
# author: Acidhub - https://acidhub.click/
|
# author: Acidhub - https://acidhub.click/
|
||||||
|
|
||||||
function fish_prompt -d "Write out the prompt"
|
function fish_prompt -d "Write out the prompt"
|
||||||
set laststatus $status
|
set -l laststatus $status
|
||||||
|
|
||||||
|
set -l git_info
|
||||||
if set -l git_branch (command git symbolic-ref HEAD 2>/dev/null | string replace refs/heads/ '')
|
if set -l git_branch (command git symbolic-ref HEAD 2>/dev/null | string replace refs/heads/ '')
|
||||||
set git_branch (set_color -o blue)"$git_branch"
|
set git_branch (set_color -o blue)"$git_branch"
|
||||||
|
set -l git_status
|
||||||
if command git diff-index --quiet HEAD --
|
if command git diff-index --quiet HEAD --
|
||||||
if set -l count (command git rev-list --count --left-right $upstream...HEAD 2>/dev/null)
|
if set -l count (command git rev-list --count --left-right $upstream...HEAD 2>/dev/null)
|
||||||
echo $count | read -l ahead behind
|
echo $count | read -l ahead behind
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
|
|
||||||
function fish_prompt --description 'Write out the prompt, prepending the Debian chroot environment if present'
|
function fish_prompt --description 'Write out the prompt, prepending the Debian chroot environment if present'
|
||||||
# Set variable identifying the chroot you work in (used in the prompt below)
|
# Set variable identifying the chroot you work in (used in the prompt below)
|
||||||
if not set -q debian_chroot
|
set -l debian_chroot $debian_chroot
|
||||||
|
if not set -q debian_chroot[1]
|
||||||
and test -r /etc/debian_chroot
|
and test -r /etc/debian_chroot
|
||||||
set debian_chroot (cat /etc/debian_chroot)
|
set debian_chroot (cat /etc/debian_chroot)
|
||||||
end
|
end
|
||||||
if not set -q __fish_debian_chroot_prompt
|
if not set -q __fish_debian_chroot_prompt
|
||||||
and set -q debian_chroot
|
and set -q debian_chroot[1]
|
||||||
and test -n "$debian_chroot"
|
and test -n "$debian_chroot"
|
||||||
set -g __fish_debian_chroot_prompt "($debian_chroot)"
|
set -g __fish_debian_chroot_prompt "($debian_chroot)"
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,8 +32,8 @@ function fish_prompt
|
||||||
|
|
||||||
function _nim_prompt_wrapper
|
function _nim_prompt_wrapper
|
||||||
set retc $argv[1]
|
set retc $argv[1]
|
||||||
set field_name $argv[2]
|
set -l field_name $argv[2]
|
||||||
set field_value $argv[3]
|
set -l field_value $argv[3]
|
||||||
|
|
||||||
set_color normal
|
set_color normal
|
||||||
set_color $retc
|
set_color $retc
|
||||||
|
@ -107,7 +107,7 @@ function fish_prompt
|
||||||
and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV")
|
and _nim_prompt_wrapper $retc V (basename "$VIRTUAL_ENV")
|
||||||
|
|
||||||
# git
|
# git
|
||||||
set prompt_git (fish_git_prompt | string trim -c ' ()')
|
set -l prompt_git (fish_git_prompt | string trim -c ' ()')
|
||||||
test -n "$prompt_git"
|
test -n "$prompt_git"
|
||||||
and _nim_prompt_wrapper $retc G $prompt_git
|
and _nim_prompt_wrapper $retc G $prompt_git
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ function fish_prompt
|
||||||
|
|
||||||
set -l cwd $cyan(basename (prompt_pwd))
|
set -l cwd $cyan(basename (prompt_pwd))
|
||||||
|
|
||||||
|
set -l repo_info
|
||||||
if set -l repo_type (_repo_type)
|
if set -l repo_type (_repo_type)
|
||||||
set -l repo_branch $red(_repo_branch_name $repo_type)
|
set -l repo_branch $red(_repo_branch_name $repo_type)
|
||||||
set repo_info "$blue $repo_type:($repo_branch$blue)"
|
set repo_info "$blue $repo_type:($repo_branch$blue)"
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
for i in $argv
|
for i in $argv
|
||||||
set template_out (basename $i .in).out
|
set -l template_out (basename $i .in).out
|
||||||
set template_err (basename $i .in).err
|
set -l template_err (basename $i .in).err
|
||||||
set template_status (basename $i .in).status
|
set -l template_status (basename $i .in).status
|
||||||
|
|
||||||
fish <$i >$template_out 2>$template_err
|
fish <$i >$template_out 2>$template_err
|
||||||
echo $status >$template_status
|
echo $status >$template_status
|
||||||
|
|
|
@ -12,6 +12,7 @@ set -x FISH_UNIT_TESTS_RUNNING 1
|
||||||
cd (dirname (status -f))
|
cd (dirname (status -f))
|
||||||
|
|
||||||
# Test files specified on commandline, or all checks.
|
# Test files specified on commandline, or all checks.
|
||||||
|
set -l files_to_test
|
||||||
if set -q argv[1]
|
if set -q argv[1]
|
||||||
set files_to_test checks/$argv.fish
|
set files_to_test checks/$argv.fish
|
||||||
else
|
else
|
||||||
|
|
|
@ -138,10 +138,10 @@ end
|
||||||
for program in {g,}date
|
for program in {g,}date
|
||||||
if command -q $program && $program --version 1>/dev/null 2>/dev/null
|
if command -q $program && $program --version 1>/dev/null 2>/dev/null
|
||||||
set -g milli $program
|
set -g milli $program
|
||||||
set unit ms
|
set -g unit ms
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
set unit sec
|
set -g unit sec
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue