mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-25 00:21:58 +00:00
add pure style to the configuration wizard
This commit is contained in:
parent
40c062c3b9
commit
640d513554
1 changed files with 40 additions and 12 deletions
|
@ -80,6 +80,16 @@ typeset -ra classic_right=(
|
|||
'' '%$frame_color[$color]F─╯%f'
|
||||
)
|
||||
|
||||
typeset -ra pure_left=(
|
||||
'' '%4F~/src%f %242Fmaster%f'
|
||||
'' '%5F❯%f █'
|
||||
)
|
||||
|
||||
typeset -ra pure_right=(
|
||||
'' ''
|
||||
'' ''
|
||||
)
|
||||
|
||||
function prompt_length() {
|
||||
local COLUMNS=1024
|
||||
local -i x y=$#1 m
|
||||
|
@ -531,17 +541,22 @@ function ask_style() {
|
|||
print -P ""
|
||||
style=classic print_prompt
|
||||
print -P ""
|
||||
print -P "%B(3) Pure.%b"
|
||||
print -P ""
|
||||
style=pure print_prompt
|
||||
print -P ""
|
||||
print -P "(r) Restart from the beginning."
|
||||
print -P "(q) Quit and do nothing."
|
||||
print -P ""
|
||||
|
||||
local key=
|
||||
read -k key${(%):-"?%BChoice [12rq]: %b"} || quit -c
|
||||
read -k key${(%):-"?%BChoice [123rq]: %b"} || quit -c
|
||||
case $key in
|
||||
q) quit;;
|
||||
r) return 1;;
|
||||
1) style=lean; options+=lean; break;;
|
||||
2) style=classic; options+=classic; break;;
|
||||
3) style=pure; options+=pure; break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -1190,6 +1205,14 @@ function ask_config_overwrite() {
|
|||
}
|
||||
|
||||
function generate_config() {
|
||||
if [[ $style == pure ]]; then
|
||||
if [[ -e $__p9k_cfg_path ]]; then
|
||||
unlink $__p9k_cfg_path || return
|
||||
fi
|
||||
cp $__p9k_root_dir/config/p10k-$style.zsh $__p9k_cfg_path || return
|
||||
return
|
||||
fi
|
||||
|
||||
local base && base="$(<$__p9k_root_dir/config/p10k-$style.zsh)" || return
|
||||
local lines=("${(@f)base}")
|
||||
|
||||
|
@ -1444,6 +1467,10 @@ while true; do
|
|||
_p9k_init_icons
|
||||
ask_narrow_icons || continue
|
||||
ask_style || continue
|
||||
if [[ $style == pure ]]; then
|
||||
empty_line=1
|
||||
options+='sparse'
|
||||
else
|
||||
ask_color || continue
|
||||
ask_time || continue
|
||||
ask_separators || continue
|
||||
|
@ -1455,6 +1482,7 @@ while true; do
|
|||
ask_empty_line || continue
|
||||
ask_extra_icons || continue
|
||||
ask_prefixes || continue
|
||||
fi
|
||||
ask_confirm || continue
|
||||
ask_config_overwrite || continue
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue