mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Make the read builtin able to create universal variables
darcs-hash:20060111122640-ac50b-4b411b9822a44ae105b71ca51ee47d0aa13a1a62.gz
This commit is contained in:
parent
d9663a4ec4
commit
032a736840
2 changed files with 10 additions and 2 deletions
11
builtin.c
11
builtin.c
|
@ -1436,6 +1436,10 @@ static int builtin_read( wchar_t **argv )
|
||||||
L"local", no_argument, 0, 'l'
|
L"local", no_argument, 0, 'l'
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
{
|
||||||
|
L"universal", no_argument, 0, 'U'
|
||||||
|
}
|
||||||
|
,
|
||||||
{
|
{
|
||||||
L"unexport", no_argument, 0, 'u'
|
L"unexport", no_argument, 0, 'u'
|
||||||
}
|
}
|
||||||
|
@ -1458,7 +1462,7 @@ static int builtin_read( wchar_t **argv )
|
||||||
|
|
||||||
int opt = wgetopt_long( argc,
|
int opt = wgetopt_long( argc,
|
||||||
argv,
|
argv,
|
||||||
L"xglup:c:",
|
L"xglUup:c:",
|
||||||
long_options,
|
long_options,
|
||||||
&opt_index );
|
&opt_index );
|
||||||
if( opt == -1 )
|
if( opt == -1 )
|
||||||
|
@ -1486,6 +1490,9 @@ static int builtin_read( wchar_t **argv )
|
||||||
case L'l':
|
case L'l':
|
||||||
place |= ENV_LOCAL;
|
place |= ENV_LOCAL;
|
||||||
break;
|
break;
|
||||||
|
case L'U':
|
||||||
|
place |= ENV_UNIVERSAL;
|
||||||
|
break;
|
||||||
case L'u':
|
case L'u':
|
||||||
place |= ENV_UNEXPORT;
|
place |= ENV_UNEXPORT;
|
||||||
break;
|
break;
|
||||||
|
@ -1517,7 +1524,7 @@ static int builtin_read( wchar_t **argv )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (place&ENV_LOCAL) && (place & ENV_GLOBAL) )
|
if( (place&ENV_LOCAL?1:0) + (place & ENV_GLOBAL?1:0) + (place & ENV_UNIVERSAL?1:0) > 1)
|
||||||
{
|
{
|
||||||
sb_printf( sb_err,
|
sb_printf( sb_err,
|
||||||
BUILTIN_ERR_GLOCAL,
|
BUILTIN_ERR_GLOCAL,
|
||||||
|
|
|
@ -3,5 +3,6 @@ complete -c read -s p -l prompt -d (_ "Set prompt command") -x
|
||||||
complete -c read -s x -l export -d (_ "Export variable to subprocess")
|
complete -c read -s x -l export -d (_ "Export variable to subprocess")
|
||||||
complete -c read -s g -l global -d (_ "Make variable scope global")
|
complete -c read -s g -l global -d (_ "Make variable scope global")
|
||||||
complete -c read -s l -l local -d (_ "Make variable scope local")
|
complete -c read -s l -l local -d (_ "Make variable scope local")
|
||||||
|
complete -c read -s U -l universal -d (_ "Make variable scope universal, i.e. share variable with all the users fish processes on this computer")
|
||||||
complete -c read -s u -l unexport -d (_ "Do not export variable to subprocess")
|
complete -c read -s u -l unexport -d (_ "Do not export variable to subprocess")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue