feat: supports LP 2.2.0
This commit is contained in:
parent
10836b337b
commit
9eea525785
1 changed files with 36 additions and 10 deletions
|
|
@ -1,5 +1,11 @@
|
|||
|
||||
_lp_liquidship_theme_activate() {
|
||||
|
||||
if ! _lp_version_greatereq 2 2 0 ; then
|
||||
_lp_join "." ${_LP_VERSION[@]}
|
||||
printf "WARNING: the LiquidShip theme requires Liquid Prompt >= 2.2.0, but you have version $lp_join, some features will not work and the prompt may crash.\n"
|
||||
fi
|
||||
|
||||
local lp_terminal_format
|
||||
local lp_terminal_format af_color='' ab_color=''
|
||||
|
||||
|
|
@ -109,6 +115,16 @@ _lp_liquidship_theme_prompt_data() {
|
|||
else
|
||||
LP_WIFI=
|
||||
fi
|
||||
if _lp_ram_color; then
|
||||
LP_RAM="$lp_ram_color "
|
||||
else
|
||||
LP_RAM=
|
||||
fi
|
||||
if _lp_disk_color; then
|
||||
LP_DISK="$lp_disk_color "
|
||||
else
|
||||
LP_DISK=
|
||||
fi
|
||||
|
||||
if _lp_time_color; then
|
||||
LP_TIME="$lp_time_color "
|
||||
|
|
@ -198,6 +214,18 @@ _lp_liquidship_theme_prompt_data() {
|
|||
LP_CMAKE=
|
||||
fi
|
||||
|
||||
if _lp_os_color; then
|
||||
LP_OPSYS="on $lp_os_color"
|
||||
else
|
||||
LP_OPSYS=
|
||||
fi
|
||||
|
||||
if _lp_modules_color; then
|
||||
LP_MODULES="via $lp_modules_color"
|
||||
else
|
||||
LP_MODULES=
|
||||
fi
|
||||
|
||||
if _lp_runtime_color; then
|
||||
LP_RUNTIME="took $lp_runtime_color "
|
||||
else
|
||||
|
|
@ -210,19 +238,18 @@ _lp_liquidship_theme_prompt_data() {
|
|||
LP_ERR=
|
||||
fi
|
||||
|
||||
if _lp_error_meaning_color; then
|
||||
LP_ERR_MEANING="(meaning: $lp_error_meaning_color)"
|
||||
else
|
||||
LP_ERR_MEANING=
|
||||
fi
|
||||
|
||||
if _lp_find_vcs && _lp_vcs_details_color; then
|
||||
LP_VCS="on $lp_vcs_details_color "
|
||||
else
|
||||
LP_VCS=
|
||||
fi
|
||||
|
||||
# Should be called after the dev env group above.
|
||||
# if _lp_dev_env_color ; then
|
||||
# LP_DEV_ENV="$lp_dev_env_color"
|
||||
# else
|
||||
# LP_DEV_ENV=
|
||||
# fi
|
||||
|
||||
_lp_smart_mark
|
||||
LP_MARK="${lp_smart_mark}${NO_COL} "
|
||||
}
|
||||
|
|
@ -240,15 +267,14 @@ _lp_liquidship_theme_prompt_template() {
|
|||
# Docker is displayed along with Singularity and Kubernetes (strange that it is not the case in Starship…),
|
||||
# in the container section, which is not duplicated at the end, like in Starship (WTF?).
|
||||
local n=$'\n'
|
||||
PS1="${LP_USER}${LP_HOST}${LP_LIQUIDSHIP_MUX}${LP_SHLVL}${LP_DIRSTACK}at ${LP_PWD}${LP_PERM} ${LP_VCS}${LP_CONTAINER}${LP_KUBECONTEXT}${LP_CMAKE}${LP_NODE_VENV}${LP_VENV}${LP_TFSPACE}${LP_AWS_PROFILE}${LP_PROXY}${LP_PS1_POSTFIX}${LP_RUNTIME}${n}"
|
||||
PS1+="${LP_TIME}${LP_WIFI}${LP_TEMP}${LP_LOAD}${LP_BATT}${LP_JOBS}${LP_LIQUIDSHIP_SUDO}${LP_ERR}${LP_COLOR_MARK}${LP_MARK}"
|
||||
PS1="${LP_USER}${LP_HOST}${LP_LIQUIDSHIP_MUX}${LP_SHLVL}${LP_DIRSTACK}at ${LP_PWD}${LP_PERM} ${LP_VCS}${LP_OPSYS}${LP_CONTAINER}${LP_KUBECONTEXT}${LP_CMAKE}${LP_NODE_VENV}${LP_VENV}${LP_TFSPACE}${LP_AWS_PROFILE}${LP_MODULES}${LP_PROXY}${LP_PS1_POSTFIX}${LP_RUNTIME}${n}"
|
||||
PS1+="${LP_TIME}${LP_WIFI}${LP_TEMP}${LP_LOAD}${LP_BATT}${LP_RAM}${LP_DISK}${LP_JOBS}${LP_LIQUIDSHIP_SUDO}${LP_ERR}${LP_ENABLE_ERROR_MEANING}${LP_COLOR_MARK}${LP_MARK}"
|
||||
|
||||
# Get the core sections without prompt escapes and make them into a title.
|
||||
_lp_formatted_title "${LP_PS1_PREFIX}${LP_BRACKET_OPEN}${LP_USER}${LP_HOST}${LP_MARK_PERM}${lp_path-}${LP_BRACKET_CLOSE}${LP_MARK_PREFIX}${LP_SHLVL}${LP_MARK}${LP_PS1_POSTFIX}"
|
||||
else
|
||||
PS1=$LP_PS1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue