mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
export: Fix replacing
Also run it through fish_indent
This commit is contained in:
parent
f6f982226a
commit
54f215294f
1 changed files with 15 additions and 14 deletions
|
@ -1,17 +1,18 @@
|
||||||
function export --description 'Set global variable. Alias for set -gx, made for bash compatibility'
|
function export --description 'Set global variable. Alias for set -gx, made for bash compatibility'
|
||||||
if test -z "$argv"
|
if test -z "$argv"
|
||||||
set
|
set
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
for arg in $argv
|
for arg in $argv
|
||||||
# Only split on the first =
|
# Only split on the first =
|
||||||
set -l v (echo $arg | string replace "=" "\n")
|
# The literal "\n" is necessary because string doesn't interpret it without -r
|
||||||
set -l c (count $v)
|
set -l v (echo $arg | string replace "=" \n)
|
||||||
switch $c
|
set -l c (count $v)
|
||||||
case 1
|
switch $c
|
||||||
set -gx $v $$v
|
case 1
|
||||||
case 2
|
set -gx $v $$v
|
||||||
set -gx $v[1] $v[2]
|
case 2
|
||||||
end
|
set -gx $v[1] $v[2]
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue