aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/abbr.fish
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-05-19 17:48:39 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-05-23 19:59:02 +0200
commitc238ad35bdd065dc9bda13ad840f1b47c325971b (patch)
tree6de2d9a8286876724610cc912b7a6e8155d5d016 /share/functions/abbr.fish
parent309e10e7a2e9455f8e80898e290865a5d49ae1bd (diff)
Fix "--" argument in abbr
Diffstat (limited to 'share/functions/abbr.fish')
-rw-r--r--share/functions/abbr.fish37
1 files changed, 19 insertions, 18 deletions
diff --git a/share/functions/abbr.fish b/share/functions/abbr.fish
index dc4f4263..6f1df7e6 100644
--- a/share/functions/abbr.fish
+++ b/share/functions/abbr.fish
@@ -5,16 +5,8 @@ function abbr --description "Manage abbreviations"
set -l mode_arg
set -l needs_arg no
while set -q argv[1]
- if test $needs_arg = single
- set mode_arg $argv[1]
- set needs_arg no
- else if test $needs_arg = multi
- set mode_arg $argv
- set needs_arg no
- set -e argv
- else
- set -l new_mode
- switch $argv[1]
+ set -l new_mode
+ switch $argv[1]
case '-h' '--help'
__fish_print_help abbr
return 0
@@ -36,16 +28,25 @@ function abbr --description "Manage abbreviations"
return 1
case '*'
break
- end
- if test -n "$mode" -a -n "$new_mode"
- # we're trying to set two different modes
- printf ( _ "%s: %s cannot be specified along with %s\n" ) abbr $argv[1] $mode_flag >&2
- return 1
- end
- set mode $new_mode
- set mode_flag $argv[1]
end
+ if test -n "$mode" -a -n "$new_mode"
+ # we're trying to set two different modes
+ printf ( _ "%s: %s cannot be specified along with %s\n" ) abbr $argv[1] $mode_flag >&2
+ return 1
+ end
+ set mode $new_mode
+ set mode_flag $argv[1]
+ set -e argv[1]
+ end
+
+ if test $needs_arg = single
+ set mode_arg $argv[1]
+ set needs_arg no
set -e argv[1]
+ else if test $needs_arg = multi
+ set mode_arg $argv
+ set needs_arg no
+ set -e argv
end
if test $needs_arg != no
printf ( _ "%s: option requires an argument -- %s\n" ) abbr $mode_flag >&2