mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2025-01-09 07:56:45 +01:00
short rust_version only when in a subdirectory of a cargo package
fixes #164
This commit is contained in:
parent
55a1b92bca
commit
0d7ba09c4f
1 changed files with 5 additions and 0 deletions
|
@ -1956,6 +1956,11 @@ prompt_rust_version() {
|
||||||
_p9k_cached_cmd_stdout rustc --version || return
|
_p9k_cached_cmd_stdout rustc --version || return
|
||||||
local v=${${_p9k_ret#rustc }%% *}
|
local v=${${_p9k_ret#rustc }%% *}
|
||||||
[[ -n $v ]] || return
|
[[ -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//\%/%%}"
|
_p9k_prompt_segment "$0" "darkorange" "$_p9k_color1" 'RUST_ICON' 0 '' "${v//\%/%%}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue