Fix ant completion (#8344)

If $xdg_chache_home is empty, this is not a valid fish expression:

    [ \( -z \) -o \( ! -d \) ]

and results into an error.

While at it, also use $XDG_CACHE_HOME if that directory does not exist.
This seems better than falling back to $HOME/.cache, which the user has
explicitly overridden via $XDG_CACHE_HOME.
This commit is contained in:
Fabian 2021-10-14 19:25:23 +02:00 committed by GitHub
parent ec8844d834
commit 72f55ab206
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ function __fish_complete_ant_targets -d "Print list of targets from build.xml an
set -l buildfile $argv[1] # full path to buildfile
set -l xdg_cache_home $XDG_CACHE_HOME[1]
if [ \( -z $xdg_cache_home \) -o \( ! -d $xdg_cache_home \) ]
if test -z "$xdg_cache_home"
set xdg_cache_home $HOME/.cache
end