From 4c0e3205a1b695d99fc765782dd520745e6ddca5 Mon Sep 17 00:00:00 2001 From: Ilan Cosman Date: Thu, 20 Aug 2020 08:44:50 -0700 Subject: [PATCH] Fix rust item --- functions/_tide_item_rust.fish | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/functions/_tide_item_rust.fish b/functions/_tide_item_rust.fish index 7a9a09a..704e1f7 100644 --- a/functions/_tide_item_rust.fish +++ b/functions/_tide_item_rust.fish @@ -1,14 +1,12 @@ function _tide_item_rust - if not type --quiet rustc || not test -e Cargo.toml || test (count *.rs) -gt 0 - return + if type --quiet rustc && test -e Cargo.toml -o (count *.rs) -gt 0 + set -l rustVersion (rustc --version | string split ' ')[2] + + if test "$tide_rust_verbose_version" = false + set rustVersion (string split '-' $rustVersion)[1] # Cut off -suffixes from version. "v1.30.0-beta" vs "v1.30.0" + end + + set_color $tide_rust_color + printf '%s' {$tide_rust_icon}' ' $rustVersion end - - set -l rustVersion (rustc --version | string split ' ')[2] - - if test "$tide_rust_verbose_version" = false - set rustVersion (string split '-' $rustVersion)[1] # Cut off -suffixes from version. "v1.30.0-beta" vs "v1.30.0" - end - - set_color $tide_rust_color - printf '%s' {$tide_rust_icon}' ' $rustVersion end \ No newline at end of file