mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Use string split in export.fish
It's a bit more explicit than replace.
This commit is contained in:
parent
b6e058985b
commit
52f8707c3e
1 changed files with 2 additions and 5 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue