File: __fish_make_cache_dir.fish

package info (click to toggle)
fish 4.2.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,976 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (14 lines) | stat: -rw-r--r-- 650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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