Files
fish-shell/share/functions/__fish_make_cache_dir.fish
Johannes Altmanninger 2c0e912fe1 Mark private functions that don't need localization
See the next commit.

Part of #11833

(cherry picked from commit a53db72564)
2025-09-30 11:52:41 +02:00

15 lines
650 B
Fish

# localization: skip(private)
function __fish_make_cache_dir --description "Create and return XDG_CACHE_HOME"
set -l xdg_cache_home $XDG_CACHE_HOME
if test -z "$xdg_cache_home"; or string match -qv '/*' -- $xdg_cache_home; or set -q xdg_cache_home[2]
set xdg_cache_home $HOME/.cache
end
# If we get an argument, we try to create that as a subdirectory.
# So if you call `__fish_make_cache_dir completions`,
# this creates e.g. ~/.cache/fish/completions
if not path is -d $xdg_cache_home/fish/"$argv[1]"
mkdir -m 700 -p $xdg_cache_home/fish/"$argv[1]"
end; and echo $xdg_cache_home/fish/"$argv[1]"
end