From 8a11aa0f8f8e4f74bdde0af74b012aa7406432bf Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Wed, 2 Oct 2024 23:30:19 +1000 Subject: [PATCH] Completions (zsh, fish): check for python3 (#1310) Both the zsh and fish completions depend on python3. When the completitions kick in with those shells where no python3 is found it throws errors. Check python3 is installed, otherwise return no completitions to avoid throwing errors Co-authored-by: Andrew Davis --- completions/fastfetch.fish | 5 +++++ completions/fastfetch.zsh | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/completions/fastfetch.fish b/completions/fastfetch.fish index 494de2730..7badab388 100755 --- a/completions/fastfetch.fish +++ b/completions/fastfetch.fish @@ -2,6 +2,11 @@ if not type -q fastfetch exit end +command -q python3 +if test $status -ne 0 + exit +end + complete -c fastfetch -f function __fastfetch_complete_bool diff --git a/completions/fastfetch.zsh b/completions/fastfetch.zsh index a6ce69279..5688c1745 100644 --- a/completions/fastfetch.zsh +++ b/completions/fastfetch.zsh @@ -1,6 +1,13 @@ #compdef fastfetch function _fastfetch() { + + whence python3 &> /dev/null + if [ $? -ne 0 ] + then + return + fi + local state local -a opts=("${(f)$(