From e9392ed80b8690526d777736395ca69ab97fb458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Vulquin?= Date: Fri, 8 Mar 2024 23:06:55 +0100 Subject: 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 (/*, ./*, ../*). --- dot_config/private_fish/functions/dot_.fish | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'dot_config/private_fish') 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 -- cgit v1.2.3