diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-08-12 09:29:59 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-08-12 09:29:59 +0300 |
commit | 0d7ba09c4fddd1719f5f24fcbd6a27b999e1cd10 (patch) | |
tree | 3053cff03246409c593fefd2a8b88f68ea180d9a /internal/p10k.zsh | |
parent | 55a1b92bcad16de8cd6a311e265de555138448d3 (diff) |
short rust_version only when in a subdirectory of a cargo package
fixes #164
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-x | internal/p10k.zsh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 72b974ea..4b503e01 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1956,6 +1956,11 @@ prompt_rust_version() { _p9k_cached_cmd_stdout rustc --version || return local v=${${_p9k_ret#rustc }%% *} [[ -n $v ]] || return + local dir=$_p9k_pwd_a + while [[ ! -e $dir/Cargo.toml ]]; do + [[ $dir == / ]] && return + dir=${dir:h} + done _p9k_prompt_segment "$0" "darkorange" "$_p9k_color1" 'RUST_ICON' 0 '' "${v//\%/%%}" } |