Guard Fish completion when cache is empty (#331)

Signed-off-by: Adam Henley <adamazing@gmail.com>
This commit is contained in:
Adam Henley 2023-07-07 02:20:46 +12:00 committed by GitHub
commit 45b3db6dc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,9 @@ complete -c tldr -l seed-config -d 'Create a basic config.' -f
complete -c tldr -l color -d 'Controls when to use color.' -xa 'always auto never'
function __tealdeer_entries
tldr --list | string replace -a -i -r "\,\s" "\n"
if set entries (tldr --list 2>/dev/null)
string replace -a -i -r "\,\s" "\n" $entries
end
end
complete -f -c tldr -a '(__tealdeer_entries)'