mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 22:21:15 -03:00
@@ -1,6 +1,6 @@
|
|||||||
function export --description 'Set global variable. Alias for set -gx, made for bash compatibility'
|
function export --description 'Set env variable. Alias for `set -gx` for bash compatibility.'
|
||||||
if test -z "$argv"
|
if not set -q argv[0]
|
||||||
set
|
set -x
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
for arg in $argv
|
for arg in $argv
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
|
function setenv --description 'Set env variable. Alias for `set -gx` for csh compatibility.'
|
||||||
function setenv --description 'Set global variable. Alias for set -g, made for csh compatibility'
|
if not set -q argv[0]
|
||||||
set -gx $argv
|
set -x
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
for arg in $argv
|
||||||
|
set -l v (string split -m 1 "=" -- $arg)
|
||||||
|
switch (count $v)
|
||||||
|
case 1
|
||||||
|
set -gx $v $$v
|
||||||
|
case 2
|
||||||
|
if contains -- $v[1] PATH CDPATH MANPATH
|
||||||
|
set -l colonized_path (string replace -- "$$v[1]" (string join ":" -- $$v[1]) $v[2])
|
||||||
|
set -gx $v[1] (string split ":" -- $colonized_path)
|
||||||
|
else
|
||||||
|
set -gx $v[1] $v[2]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user