Use string split in export.fish

It's a bit more explicit than replace.
This commit is contained in:
Fabian Homborg 2016-02-10 20:33:43 +01:00
parent b6e058985b
commit 52f8707c3e

View file

@ -4,11 +4,8 @@ function export --description 'Set global variable. Alias for set -gx, made for
return 0 return 0
end end
for arg in $argv for arg in $argv
# Only split on the first = set -l v (string split -m 1 "=" -- $arg)
# The literal "\n" is necessary because string doesn't interpret it without -r switch (count $v)
set -l v (echo $arg | string replace "=" \n)
set -l c (count $v)
switch $c
case 1 case 1
set -gx $v $$v set -gx $v $$v
case 2 case 2