diff --git a/builtin.c b/builtin.c index 7ffafe059..fbb4400f2 100644 --- a/builtin.c +++ b/builtin.c @@ -1436,6 +1436,10 @@ static int builtin_read( wchar_t **argv ) L"local", no_argument, 0, 'l' } , + { + L"universal", 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, argv, - L"xglup:c:", + L"xglUup:c:", long_options, &opt_index ); if( opt == -1 ) @@ -1486,6 +1490,9 @@ static int builtin_read( wchar_t **argv ) case L'l': place |= ENV_LOCAL; break; + case L'U': + place |= ENV_UNIVERSAL; + break; case L'u': place |= ENV_UNEXPORT; break; @@ -1517,7 +1524,7 @@ static int builtin_read( wchar_t **argv ) 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, BUILTIN_ERR_GLOCAL, diff --git a/init/completions/read.fish b/init/completions/read.fish index cb9bf842b..e6bac1358 100644 --- a/init/completions/read.fish +++ b/init/completions/read.fish @@ -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 g -l global -d (_ "Make variable scope global") 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")