mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
export: Fix replacing
Also run it through fish_indent
This commit is contained in:
parent
f6f982226a
commit
54f215294f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user