From 7118269e4b3b6714c71f0042f85354eac3c72603 Mon Sep 17 00:00:00 2001 From: axel Date: Fri, 9 Feb 2007 03:01:18 +1000 Subject: [PATCH] Minor tweaks to vared function darcs-hash:20070208170118-ac50b-76ea318d47de28a4437ecf0a50daea2c617017ea.gz --- share/functions/vared.fish | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/share/functions/vared.fish b/share/functions/vared.fish index 19da02d54..feadaadc2 100644 --- a/share/functions/vared.fish +++ b/share/functions/vared.fish @@ -18,25 +18,25 @@ function vared --description "Edit variable value" case '*' if test (count $$argv ) -lt 2 - set init '' + set -l init '' if test $$argv set init $$argv end - set prompt 'set_color green; echo '$argv'; set_color normal; echo "> "' - read -p $prompt -c $init tmp + set -l prompt 'set_color green; echo '$argv'; set_color normal; echo "> "' + if read -p $prompt -c $init tmp - # If variable already exists, do not add any - # switches, so we don't change export rules. But - # if it does not exist, we make the variable - # global, so that it will not die when this - # function dies + # If variable already exists, do not add any + # switches, so we don't change export rules. But + # if it does not exist, we make the variable + # global, so that it will not die when this + # function dies - if test $$argv - set -- $argv $tmp - else - set -g -- $argv $tmp + if test $$argv + set $argv $tmp + else + set -g $argv $tmp + end end - else printf (_ '%s: %s is an array variable. Use %svared%s %s[n] to edit the n:th element of %s\n') $argv (set_color $fish_color_command) (set_color $fish_color_normal) vared $argv $argv