Allow set --query to check for pathvarness (#8494)

Currently,

    set -q --unpath PATH

simply ignores the "--unpath" bit (and same for "--path").

This changes it, so just like exportedness you can check pathness.
This commit is contained in:
Fabian Homborg
2021-11-26 18:29:10 +01:00
committed by GitHub
parent 41be9fa9fd
commit 47e45704b1
4 changed files with 34 additions and 1 deletions

View File

@@ -415,10 +415,30 @@ set --unpath __fish_test_PATH $__fish_test_PATH
echo "$__fish_test_path_not $__fish_test_PATH" $__fish_test_path_not $__fish_test_PATH
# CHECK: a b c 1 2 3 a b c 1 2 3
set -q --path __fish_test_PATH
and echo __fish_test_PATH is a pathvar
or echo __fish_test_PATH is not a pathvar
# CHECK: __fish_test_PATH is not a pathvar
set -q --unpath __fish_test_PATH
and echo __fish_test_PATH is not a pathvar
or echo __fish_test_PATH is not not a pathvar
# CHECK: __fish_test_PATH is not a pathvar
set --path __fish_test_path_not $__fish_test_path_not
echo "$__fish_test_path_not $__fish_test_PATH" $__fish_test_path_not $__fish_test_PATH
# CHECK: a:b:c 1 2 3 a b c 1 2 3
set -q --path __fish_test_path_not
and echo __fish_test_path_not is a pathvar
or echo __fish_test_path_not is not a pathvar
# CHECK: __fish_test_path_not is a pathvar
set -q --unpath __fish_test_path_not
and echo __fish_test_path_not is not a pathvar
or echo __fish_test_path_not is not not a pathvar
# CHECK: __fish_test_path_not is not not a pathvar
set --path __fish_test_PATH $__fish_test_PATH
echo "$__fish_test_path_not $__fish_test_PATH" $__fish_test_path_not $__fish_test_PATH
# CHECK: a:b:c 1:2:3 a b c 1 2 3