diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-07-18 23:15:35 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-07-18 23:15:35 +0300 |
commit | b61d021abdf0987960022ca6999549ef33ce9681 (patch) | |
tree | 830249d5dcec5e25a05b5475022299e9b6b25e6c /powerlevel9k.zsh-theme | |
parent | 829c7ceaae4f8bb72420c65afc0e2c011a359d71 (diff) |
Simplify detect_virt segment
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 144b4df4..2e645f0a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1046,18 +1046,14 @@ prompt_history() { ################################################################ # Detection for virtualization (systemd based systems only) prompt_detect_virt() { - if ! command -v systemd-detect-virt > /dev/null; then - return - fi - local virt=$(systemd-detect-virt) + local virt=$(systemd-detect-virt 2> /dev/null) if [[ "$virt" == "none" ]]; then if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then virt="chroot" - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" - else - ; fi - else + fi + + if [[ -n "${virt}" ]]; then "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" fi } |