Skip to content

Commit

Permalink
revert(zsh): use number as prompt cli
Browse files Browse the repository at this point in the history
This reverts commit 002273b.
  • Loading branch information
kaplanz committed Feb 12, 2024
1 parent 9f7c654 commit 1ff4ef4
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions apps/zsh/themes/prompt_century_setup
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ prompt_century_help () {
Usage: prompt century [OPTIONS]
Options:
-n <LINES> Number of lines to render prompt
-<1|2|3> Lines to render prompt
-x Exchange prompt segments
-h Print help
EOF
Expand All @@ -29,15 +29,10 @@ EOF
function prompt_century_setup() {
# Parse opts
local -A args
while getopts "n:xh" opt; do
while getopts "123xh" opt; do
case $opt in
n)
if [[ "$OPTARG" =~ "^[1-3]$" ]]; then
args[nlines]="$OPTARG"
else
echo "$0:$LINENO: bad argument for -$opt: $OPTARG"
return 1
fi
1|2|3)
args[nlines]=$opt
;;
x)
args[change]=true
Expand Down Expand Up @@ -126,15 +121,15 @@ function prompt_century_setup() {
# Prompts
PS1=
PS2=
case $args[nlines] in
case ${args[nlines]:-2} in
1)
PS1+="${PRE}${SEGMENT02}${SYM}${RST}"
RPS1="${TMR}${SEGMENT01}${CLK}${RST}"
;;
3)
PS1+="${prompt_newline}"
;&
2|"")
;& # fallthrough
2)
PS1+="${TOP}${SEGMENT01}${prompt_newline}"
PS1+="${BTM}${SEGMENT02}${SYM}${RST}"
RPS1="${TMR}${CLK}${RST}"
Expand Down Expand Up @@ -175,7 +170,7 @@ function prompt_century_precmd() {
# ----------------

function prompt_century_preview() {
local cfg=("-n1" "-xn1" "-n2" "-xn2")
local cfg=("-1" "-1x" "-2" "-2x")

if (( ! $#* )); then
for opt in $cfg[@]; do
Expand Down

0 comments on commit 1ff4ef4

Please sign in to comment.