mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-22 06:48:56 +08:00
Fix issue if md5sum is used instead of md5 (#6958)
* Fix issue if md5sum is used instead of md5 Both have a different output which results in different array sized Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com> * Add feedback Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>
This commit is contained in:
parent
02e9486559
commit
54f3fbbf8c
@ -7,12 +7,13 @@ end
|
||||
|
||||
function __fish_gradle_create_completion_cache_file
|
||||
# Set up cache directory
|
||||
if test -z $XDG_CACHE_HOME
|
||||
if test -z "$XDG_CACHE_HOME"
|
||||
set XDG_CACHE_HOME $HOME/.cache
|
||||
end
|
||||
mkdir -m 700 -p $XDG_CACHE_HOME/gradle-completions
|
||||
mkdir -m 700 -p "$XDG_CACHE_HOME/gradle-completions"
|
||||
|
||||
string trim -- $XDG_CACHE_HOME/gradle-completions/(__fish_md5 -s $argv[1] | string split ' = ')[2]
|
||||
set -l md5Hash (__fish_md5 -s $argv[1] | string replace -r '.* = ' '')
|
||||
string trim -- "$XDG_CACHE_HOME/gradle-completions/$md5Hash"
|
||||
end
|
||||
|
||||
##############################
|
||||
@ -51,12 +52,12 @@ function __fish_gradle_get_task_completion
|
||||
end
|
||||
|
||||
set -l gradle_cache_file (__fish_gradle_create_completion_cache_file "{$PWD}-tasks")
|
||||
if not command test -f $gradle_cache_file -a -s $gradle_cache_file
|
||||
command gradle -q tasks --all 2>/dev/null | string match --regex '^[a-z][A-z:]+.*' | string replace ' - ' \t >$gradle_cache_file
|
||||
if not test -f "$gradle_cache_file" -a -s "$gradle_cache_file"
|
||||
command gradle -q tasks --all 2>/dev/null | string match --regex '^[a-z][A-z:]+.*' | string replace ' - ' \t >"$gradle_cache_file"
|
||||
end
|
||||
|
||||
# return possible tasks
|
||||
string trim -- <$gradle_cache_file
|
||||
string trim -- <"$gradle_cache_file"
|
||||
end
|
||||
|
||||
complete --command 'gw' --command 'gradle' --command 'gradlew' \
|
||||
|
Loading…
x
Reference in New Issue
Block a user