mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-24 05:00:07 +00:00
Add error handling for poetry cmd
This commit is contained in:
parent
f2772bd56f
commit
81c474ce53
1 changed files with 5 additions and 2 deletions
|
@ -4289,7 +4289,7 @@ _virtualenv_load_name_VIRTUAL_ENV() {
|
||||||
# Use parent directory name if virtualenv name is generic (eg .venv)
|
# Use parent directory name if virtualenv name is generic (eg .venv)
|
||||||
elif [[ ${VIRTUAL_ENV:t} == $~_POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES ]]; then
|
elif [[ ${VIRTUAL_ENV:t} == $~_POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES ]]; then
|
||||||
_virtualenv_name=${VIRTUAL_ENV:h:t}
|
_virtualenv_name=${VIRTUAL_ENV:h:t}
|
||||||
# Otherwise use the virtualenv name as-is
|
# Otherwise use the name as-is
|
||||||
else
|
else
|
||||||
_virtualenv_name=${VIRTUAL_ENV:t}
|
_virtualenv_name=${VIRTUAL_ENV:t}
|
||||||
fi
|
fi
|
||||||
|
@ -4298,7 +4298,10 @@ _virtualenv_load_name_poetry() {
|
||||||
local idx=$1
|
local idx=$1
|
||||||
local dir=${_p9k__parent_dirs[idx]}
|
local dir=${_p9k__parent_dirs[idx]}
|
||||||
local pyproject="$dir/pyproject.toml"
|
local pyproject="$dir/pyproject.toml"
|
||||||
_p9k_cached_cmd 0 "$pyproject" poetry -C "$dir" version
|
if ! _p9k_cached_cmd 0 "$pyproject" poetry -C "$dir" version; then
|
||||||
|
# poetry execution failed. Display nothing.
|
||||||
|
_virtualenv_name=""
|
||||||
|
fi
|
||||||
# Return the first word only, eg the value of pyproject.toml's `poetry.name`
|
# Return the first word only, eg the value of pyproject.toml's `poetry.name`
|
||||||
_virtualenv_name="${_p9k__ret%% *}"
|
_virtualenv_name="${_p9k__ret%% *}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue