diff options
| author | 2024-03-08 23:06:55 +0100 | |
|---|---|---|
| committer | 2024-03-08 23:06:55 +0100 | |
| commit | e9392ed80b8690526d777736395ca69ab97fb458 (patch) | |
| tree | 283aec3fc87e7aaa41470fa5cc59fb92933e8d11 /dot_config/private_fish/functions/dot_.fish | |
| parent | sh: remove old .local/lib/sh (diff) | |
fish: rework .()
1. We default to $PATH now, but allow having an explicit $DOTPATH.
This is important because the UX of source-ing /bin/ls is bad.
2. Explicit handling for real paths (/*, ./*, ../*).
Diffstat (limited to 'dot_config/private_fish/functions/dot_.fish')
| -rw-r--r-- | dot_config/private_fish/functions/dot_.fish | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/dot_config/private_fish/functions/dot_.fish b/dot_config/private_fish/functions/dot_.fish index 93aca5a..64ece91 100644 --- a/dot_config/private_fish/functions/dot_.fish +++ b/dot_config/private_fish/functions/dot_.fish @@ -1,7 +1,16 @@ function . -a name if ! test -n "$name"; return 255; end set -e argv[1] - for path in . $PATH + + # handle real paths + if string match -q '/*' $name + or string match -q './*' $name + or string match -q '../*' $name + source $name $argv + end + + set -q DOTPATH || set -l DOTPATH $PATH + for path in $DOTPATH if test -r $path/$name.fish source $path/$name.fish $argv return |
