diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2015-10-12 11:35:45 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2015-10-12 11:35:45 +0200 |
commit | 54f215294f2387c67ba53e35990f989f6672c46c (patch) | |
tree | 26822e9c3563956a946113d806ec1982569b3931 | |
parent | f6f982226a4d16ed8e740a66fe9a505a8df86e8c (diff) |
export: Fix replacing
Also run it through fish_indent
-rw-r--r-- | share/functions/export.fish | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/share/functions/export.fish b/share/functions/export.fish index 7c6248e6..3f83cf4e 100644 --- a/share/functions/export.fish +++ b/share/functions/export.fish @@ -1,17 +1,18 @@ function export --description 'Set global variable. Alias for set -gx, made for bash compatibility' - if test -z "$argv" - set - return 0 - end - for arg in $argv - # Only split on the first = - set -l v (echo $arg | string replace "=" "\n") - set -l c (count $v) - switch $c - case 1 - set -gx $v $$v - case 2 - set -gx $v[1] $v[2] - end + if test -z "$argv" + set + return 0 + end + for arg in $argv + # Only split on the first = + # The literal "\n" is necessary because string doesn't interpret it without -r + set -l v (echo $arg | string replace "=" \n) + set -l c (count $v) + switch $c + case 1 + set -gx $v $$v + case 2 + set -gx $v[1] $v[2] end + end end |