Revert "use the new set -a and set -p in our scripts"

This reverts commit 8b79f4e5c9.
It was meant for the major branch.
This commit is contained in:
Kurtis Rader 2017-08-13 15:32:16 -07:00
parent 296008089c
commit 088b21a15f
23 changed files with 67 additions and 63 deletions

View file

@ -1,3 +1,4 @@
function __fish_bind_test1
set -l args
set -l use_keys no
@ -9,7 +10,7 @@ function __fish_bind_test1
case "-*"
case "*"
set -a args $i
set args $args $i
end
end

View file

@ -1,3 +1,4 @@
function __fish_bind_test2
set -l args
for i in (commandline -poc)
@ -5,7 +6,7 @@ function __fish_bind_test2
case "-*"
case "*"
set -a args $i
set args $args $i
end
end

View file

@ -145,13 +145,13 @@ function __fish_complete_mount_opts
switch (string replace -r '=.*' '=' -- $last_arg)
case uid=
set -a fish_mount_opts uid=(__fish_print_user_ids)
set fish_mount_opts $fish_mount_opts uid=(__fish_print_user_ids)
case gid=
set -a fish_mount_opts gid=(__fish_print_group_ids)
set fish_mount_opts $fish_mount_opts gid=(__fish_print_group_ids)
case setuid=
set -a fish_mount_opts setuid=(__fish_print_user_ids)
set fish_mount_opts $fish_mount_opts setuid=(__fish_print_user_ids)
case setgid=
set -a fish_mount_opts setgid=(__fish_print_group_ids)
set fish_mount_opts $fish_mount_opts setgid=(__fish_print_group_ids)
end

View file

@ -14,33 +14,33 @@ function __fish_complete_proc --description 'Complete by list of running process
set ps_opt -A -o command
# Erase everything after the first space
set -a sed_cmds 's/ .*//'
set sed_cmds $sed_cmds 's/ .*//'
# Erases weird stuff Linux gives like kworker/0:0
set -a sed_cmds 's|/[0-9]:[0-9]]$||g'
set sed_cmds $sed_cmds 's|/[0-9]:[0-9]]$||g'
# Retain the last path component only
set -a sed_cmds 's|.*/||g'
set sed_cmds $sed_cmds 's|.*/||g'
# Strip off square brackets. Cute, huh?
set -a sed_cmds 's/[][]//g'
set sed_cmds $sed_cmds 's/[][]//g'
# Erase things that are just numbers
set -a sed_cmds 's/^[0-9]*$//'
set sed_cmds $sed_cmds 's/^[0-9]*$//'
else
# OS X, BSD. Preserve leading spaces.
set ps_opt axc -o comm
# Delete parenthesized (zombie) processes
set -a sed_cmds '/(.*)/d'
set sed_cmds $sed_cmds '/(.*)/d'
end
# Append sed command to delete first line (the header)
set -a sed_cmds '1d'
set sed_cmds $sed_cmds '1d'
# Append sed commands to delete leading dashes and trailing spaces
# In principle, commands may have trailing spaces, but ps emits space padding on OS X
set -a sed_cmds 's/^-//' 's/ *$//'
set sed_cmds $sed_cmds 's/^-//' 's/ *$//'
# Run ps, pipe it through our massive set of sed commands, then sort and unique
ps $ps_opt | sed '-e '$sed_cmds | sort -u

View file

@ -1,4 +1,6 @@
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 PATH /sbin /usr/sbin $PATH ^/dev/null
__fish_complete_subcommand $argv
end

View file

@ -6,7 +6,7 @@ function __fish_contains_opt -d "Checks if a specific option has been given in t
for i in $argv
if test -n "$next_short"
set next_short
set -a short_opt $i
set short_opt $short_opt $i
else
switch $i
case -s
@ -15,7 +15,7 @@ function __fish_contains_opt -d "Checks if a specific option has been given in t
echo __fish_contains_opt: Unknown option $i >&2
return 1
case '*'
set -a long_opt $i
set long_opt $long_opt $i
end
end
end

View file

@ -724,7 +724,7 @@ end
set -l varargs
for var in repaint describe_style show_informative_status showdirtystate showstashstate showuntrackedfiles showupstream
set -a varargs --on-variable __fish_git_prompt_$var
set varargs $varargs --on-variable __fish_git_prompt_$var
end
function __fish_git_prompt_repaint $varargs --description "Event handler, repaints prompt when functionality changes"
if status --is-interactive
@ -741,9 +741,9 @@ end
set -l varargs
for var in '' _prefix _suffix _bare _merging _cleanstate _invalidstate _upstream _flags _branch _dirtystate _stagedstate _branch_detached _stashstate _untrackedfiles
set -a varargs --on-variable __fish_git_prompt_color$var
set varargs $varargs --on-variable __fish_git_prompt_color$var
end
set -a varargs --on-variable __fish_git_prompt_showcolorhints
set varargs $varargs --on-variable __fish_git_prompt_showcolorhints
function __fish_git_prompt_repaint_color $varargs --description "Event handler, repaints prompt when any color changes"
if status --is-interactive
set -l var $argv[3]
@ -762,7 +762,7 @@ end
set -l varargs
for var in cleanstate dirtystate invalidstate stagedstate stashstate stateseparator untrackedfiles upstream_ahead upstream_behind upstream_diverged upstream_equal upstream_prefix
set -a varargs --on-variable __fish_git_prompt_char_$var
set varargs $varargs --on-variable __fish_git_prompt_char_$var
end
function __fish_git_prompt_repaint_char $varargs --description "Event handler, repaints prompt when any char changes"
if status --is-interactive

View file

@ -70,17 +70,17 @@ function __fish_hg_prompt --description 'Write out the hg prompt'
# Add a character for each file status if we have one
switch $line
case 'A '
set -a hg_statuses added
set hg_statuses $hg_statuses added
case 'M ' ' M'
set -a hg_statuses modified
set hg_statuses $hg_statuses modified
case 'C '
set -a hg_statuses copied
set hg_statuses $hg_statuses copied
case 'D ' ' D'
set -a hg_statuses deleted
set hg_statuses $hg_statuses deleted
case '\? '
set -a hg_statuses untracked
set hg_statuses $hg_statuses untracked
case 'U*' '*U' 'DD' 'AA'
set -a hg_statuses unmerged
set hg_statuses $hg_statuses unmerged
end
end

View file

@ -2,8 +2,6 @@ function __fish_make_completion_signals --description 'Make list of kill signals
set -q __kill_signals
and return 0
set -g __kill_signals
# Some systems use the GNU coreutils kill command where `kill -L` produces an extended table
# format that looks like this:
#
@ -18,17 +16,18 @@ function __fish_make_completion_signals --description 'Make list of kill signals
# 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)
set -a __kill_signals $i" "(kill -l $i | tr '[:lower:]' '[:upper:]')
set -g __kill_signals $__kill_signals $i" "(kill -l $i | tr '[:lower:]' '[:upper:]')
end
else
# Debian and some related systems use 'kill -L' to write out a numbered list
# of signals. Use this to complete on both number _and_ on signal name.
complete -c kill -s L --description "List codes and names of available signals"
set -g __kill_signals
kill -L | sed -e 's/^ //; s/ */ /g; y/ /\n/' | while read -l signo
test -z "$signo"
and break # the sed above produces one blank line at the end
read -l signame
set -a __kill_signals "$signo $signame"
set -g __kill_signals $__kill_signals "$signo $signame"
end
end
end

View file

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

View file

@ -53,7 +53,7 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
set -l orig_dir $PWD
set -l paths
for config in $argv
set -a paths (cat $config ^/dev/null \
set paths $paths (cat $config ^/dev/null \
# Keep only Include lines
| string match -r -i '^\s*Include\s+.+' \
# Remove Include syntax
@ -91,7 +91,7 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
# Print hosts from system wide ssh configuration file
string match -r -i '^\s*Host\s+\S+' <$file | string replace -r -i '^\s*Host\s+' '' | string trim | string replace -r '\s+' ' ' | string split ' ' | string match -v '*\**'
# Extract known_host paths.
set -a known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' <$file | string replace -ri '.*KnownHostsFile\s*' '')
set known_hosts $known_hosts (string match -ri '^\s*UserKnownHostsFile|^\s*GlobalKnownHostsFile' <$file | string replace -ri '.*KnownHostsFile\s*' '')
end
end
for file in $known_hosts

View file

@ -10,9 +10,9 @@
function __fish_set_locale
set -l LOCALE_VARS
set -a LOCALE_VARS LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE
set -a LOCALE_VARS LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS
set -a LOCALE_VARS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
set LOCALE_VARS $LOCALE_VARS LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE
set LOCALE_VARS $LOCALE_VARS LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS
set LOCALE_VARS $LOCALE_VARS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
# We check LC_ALL to figure out if we have a locale but we don't set it later. That is because
# locale.conf doesn't allow it so we should not set it.

View file

@ -52,19 +52,19 @@ function __terlar_git_prompt --description 'Write out the git prompt'
switch $i
case 'A '
set -a gs added
set gs $gs added
case 'M ' ' M'
set -a gs modified
set gs $gs modified
case 'R '
set -a gs renamed
set gs $gs renamed
case 'C '
set -a gs copied
set gs $gs copied
case 'D ' ' D'
set -a gs deleted
set gs $gs deleted
case '\?\?'
set -a gs untracked
set gs $gs untracked
case 'U*' '*U' 'DD' 'AA'
set -a gs unmerged
set gs $gs unmerged
end
end

View file

@ -1,7 +1,7 @@
function abbr --description "Manage abbreviations using new fish 3.0 scheme."
set -l options --stop-nonopt --exclusive 'a,r,e,l,s' --exclusive 'g,U'
set -a options 'h/help' 'a/add' 'r/rename' 'e/erase' 'l/list' 's/show'
set -a options 'g/global' 'U/universal'
set options $options 'h/help' 'a/add' 'r/rename' 'e/erase' 'l/list' 's/show'
set options $options 'g/global' 'U/universal'
argparse -n abbr $options -- $argv
or return

View file

@ -35,7 +35,7 @@ function cd --description "Change directory"
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g -a dirprev $previous
set -g dirprev $dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
end

View file

@ -26,7 +26,7 @@ function cdh --description "Menu based cd command"
set -l uniq_dirs
for dir in $all_dirs[-1..1]
if not contains $dir $uniq_dirs
set -a uniq_dirs $dir
set uniq_dirs $uniq_dirs $dir
end
end

View file

@ -10,9 +10,9 @@ function help --description 'Show help for the fish shell'
set -l fish_help_item $argv[1]
set -l help_topics syntax completion editor job-control todo bugs history killring help
set -a help_topics color prompt title variables builtin-overview changes expand
set -a help_topics expand-variable expand-home expand-brace expand-wildcard
set -a help_topics expand-command-substitution expand-process
set help_topics $help_topics color prompt title variables builtin-overview changes expand
set help_topics $help_topics expand-variable expand-home expand-brace expand-wildcard
set help_topics $help_topics expand-command-substitution expand-process
#
# Find a suitable browser for viewing the help pages. This is needed

View file

@ -19,14 +19,14 @@ function history --description "display or manipulate interactive command histor
set -l cmd history
set -l options --exclusive 'c,e,p' --exclusive 'S,D,M,V,C' --exclusive 't,T'
set -a options 'h/help' 'c/contains' 'e/exact' 'p/prefix'
set -a options 'C/case-sensitive' 'z/null' 't/show-time=?' 'n#max'
set options $options 'h/help' 'c/contains' 'e/exact' 'p/prefix'
set options $options 'C/case-sensitive' 'z/null' 't/show-time=?' 'n#max'
# This long option is deprecated and here solely for legacy compatibility. People should use
# -t or --show-time now.
set -a options 'T-with-time=?'
set options $options 'T-with-time=?'
# The following options are deprecated and will be removed in the next major release.
# Note that they do not have usable short flags.
set -a options 'S-search' 'D-delete' 'M-merge' 'V-save' 'R-clear'
set options $options 'S-search' 'D-delete' 'M-merge' 'V-save' 'R-clear'
argparse -n $cmd $options -- $argv
or return

View file

@ -6,7 +6,7 @@ if command ls --version >/dev/null ^/dev/null
function ls --description "List contents of directory"
set -l param --color=auto
if isatty 1
set -a param --indicator-style=classify
set param $param --indicator-style=classify
end
command ls $param $argv
end

View file

@ -77,6 +77,6 @@ function pushd --description 'Push directory to stack'
end
# argv[1] is a directory
set -g -p dirstack $PWD
set -g dirstack $PWD $dirstack
cd $argv[1]
end

View file

@ -23,8 +23,8 @@ end
function realpath -d "return an absolute path without symlinks"
set -l options 'h/help' 'q/quiet' 'V-version' 's/strip' 'N-no-symlinks' 'z/zero'
set -a options 'e/canonicalize-existing' 'm/canonicalize-missing' 'L/logical' 'P/physical'
set -a options 'R-relative-to=' 'B-relative-base='
set options $options 'e/canonicalize-existing' 'm/canonicalize-missing' 'L/logical' 'P/physical'
set options $options 'R-relative-to=' 'B-relative-base='
argparse -n realpath --min-args=1 $options -- $argv
or return

View file

@ -14,7 +14,7 @@ if not contains string (builtin -n)
set -g __is_launched_without_string 1
end
end
set -p PATH $__fish_bin_dir
set PATH $__fish_bin_dir $PATH
set string_cmd string \'$argv\'
if fish -c 'contains string (builtin -n)'

View file

@ -87,9 +87,9 @@ function __fish_umask_parse
string match -q '*u*' $scope
and set scopes_to_modify 1
string match -q '*g*' $scope
and set -a scopes_to_modify 2
and set scopes_to_modify $scopes_to_modify 2
string match -q '*o*' $scope
and set -a scopes_to_modify 3
and set scopes_to_modify $scopes_to_modify 3
string match -q '*a*' $scope
and set scopes_to_modify 1 2 3