format options better

pull/186/head
romkatv 5 years ago
parent a6b572da45
commit 6d11cb5f5d

@ -277,7 +277,7 @@ function ask_narrow_icons() {
q) quit;; q) quit;;
r) return 1;; r) return 1;;
y) cap_narrow_icons=1; options+='small icons'; break;; y) cap_narrow_icons=1; options+='small icons'; break;;
n) cap_narrow_icons=0; break;; n) cap_narrow_icons=0; options+='large icons'; break;;
esac esac
done done
} }
@ -417,7 +417,7 @@ function ask_prefixes() {
case $key in case $key in
q) quit;; q) quit;;
r) return 1;; r) return 1;;
1) prefixes=('' ''); break;; 1) prefixes=('' ''); options+=concise; break;;
2) prefixes=("$fluent[@]"); options+=fluent; break;; 2) prefixes=("$fluent[@]"); options+=fluent; break;;
esac esac
done done
@ -461,7 +461,7 @@ function ask_separators() {
right_sep=$left_triangle right_sep=$left_triangle
left_subsep=$right_angle left_subsep=$right_angle
right_subsep=$left_angle right_subsep=$left_angle
options+='angled sep' options+='angled separators'
break break
;; ;;
2) 2)
@ -469,7 +469,7 @@ function ask_separators() {
right_sep='' right_sep=''
left_subsep=$vertical_bar left_subsep=$vertical_bar
right_subsep=$vertical_bar right_subsep=$vertical_bar
options+='vertical sep' options+='vertical separators'
break break
;; ;;
3) 3)
@ -478,7 +478,7 @@ function ask_separators() {
right_sep=$up_triangle right_sep=$up_triangle
left_subsep=$slanted_bar left_subsep=$slanted_bar
right_subsep=$slanted_bar right_subsep=$slanted_bar
options+='slanted sep' options+='slanted separators'
break break
fi fi
;; ;;
@ -910,8 +910,19 @@ function generate_config() {
fi fi
fi fi
header+=$'.\n' header+=$'.\n'
header+="# Wizard options: ${(j:, :)options}" local line="# Wizard options: $options[1]"
header+=$'.\n#' local opt
for opt in $options[2,-1]; do
if (( $#line + $#opt > 85 )); then
header+=$line
header+=$',\n'
line="# $opt"
else
line+=", $opt"
fi
done
header+=$line
header+=$'.\n# Type `p10k configure` to generate another config.\n#'
if [[ -e $__p9k_cfg_path ]]; then if [[ -e $__p9k_cfg_path ]]; then
unlink $__p9k_cfg_path || return 1 unlink $__p9k_cfg_path || return 1

Loading…
Cancel
Save