mirror of
https://github.com/mjsarfatti/beddu.git
synced 2025-06-26 17:08:01 +02:00
Add upclear utility
This commit is contained in:
parent
76d136f64c
commit
24633a743e
14 changed files with 42 additions and 56 deletions
3
Makefile
3
Makefile
|
@ -33,8 +33,9 @@ $(OUTPUT): $(ALL_SRC_FILES)
|
||||||
@echo '# beddu.sh - A lightweight bash framework for interactive scripts and pretty output' >> $(OUTPUT)
|
@echo '# beddu.sh - A lightweight bash framework for interactive scripts and pretty output' >> $(OUTPUT)
|
||||||
@echo '# https://github.com/mjsarfatti/beddu' >> $(OUTPUT)
|
@echo '# https://github.com/mjsarfatti/beddu' >> $(OUTPUT)
|
||||||
@echo '#' >> $(OUTPUT)
|
@echo '#' >> $(OUTPUT)
|
||||||
|
@echo '# Version: $(shell git describe --tags --dirty)' >> $(OUTPUT)
|
||||||
@echo '# Generated on: $(shell date)' >> $(OUTPUT)
|
@echo '# Generated on: $(shell date)' >> $(OUTPUT)
|
||||||
@# Process each file, stripping (line) comments and empty lines
|
@# Process each file, stripping comments and empty lines
|
||||||
@for file in $(ALL_SRC_FILES); do \
|
@for file in $(ALL_SRC_FILES); do \
|
||||||
echo "" >> $(OUTPUT); \
|
echo "" >> $(OUTPUT); \
|
||||||
grep -v '^\s*#' "$$file" | sed '/^[[:space:]]*$$/d' | sed 's/#[a-zA-Z0-9 ]*$$//' >> $(OUTPUT); \
|
grep -v '^\s*#' "$$file" | sed '/^[[:space:]]*$$/d' | sed 's/#[a-zA-Z0-9 ]*$$//' >> $(OUTPUT); \
|
||||||
|
|
|
@ -4,16 +4,17 @@
|
||||||
# beddu.sh - A lightweight bash framework for interactive scripts and pretty output
|
# beddu.sh - A lightweight bash framework for interactive scripts and pretty output
|
||||||
# https://github.com/mjsarfatti/beddu
|
# https://github.com/mjsarfatti/beddu
|
||||||
#
|
#
|
||||||
# Generated on: Fri May 9 20:00:08 CEST 2025
|
# Version: v0.0.3-dirty
|
||||||
|
# Generated on: Sun May 11 01:40:08 CEST 2025
|
||||||
|
|
||||||
_q='?'
|
readonly _q='?'
|
||||||
_a='❯'
|
readonly _a='❯'
|
||||||
_o='◌'
|
readonly _o='◌'
|
||||||
_O='●'
|
readonly _O='●'
|
||||||
_mark='✓'
|
readonly _mark='✓'
|
||||||
_warn='!'
|
readonly _warn='!'
|
||||||
_cross='✗'
|
readonly _cross='✗'
|
||||||
_spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt
|
readonly _spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt
|
||||||
export _q _a _o _O _mark _warn _cross _spinner
|
export _q _a _o _O _mark _warn _cross _spinner
|
||||||
|
|
||||||
up() {
|
up() {
|
||||||
|
@ -32,9 +33,7 @@ cl() {
|
||||||
printf "\033[2K"
|
printf "\033[2K"
|
||||||
}
|
}
|
||||||
upclear() {
|
upclear() {
|
||||||
up
|
up; bol; cl
|
||||||
bol
|
|
||||||
cl
|
|
||||||
}
|
}
|
||||||
line() {
|
line() {
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
@ -118,9 +117,7 @@ export -f run
|
||||||
check() {
|
check() {
|
||||||
if spinning; then
|
if spinning; then
|
||||||
spop
|
spop
|
||||||
up
|
upclear
|
||||||
bol
|
|
||||||
cl
|
|
||||||
fi
|
fi
|
||||||
pen -n green "${_mark:-✓} "
|
pen -n green "${_mark:-✓} "
|
||||||
pen "$@"
|
pen "$@"
|
||||||
|
@ -183,9 +180,7 @@ export -f spin spop spinning
|
||||||
throw() {
|
throw() {
|
||||||
if spinning; then
|
if spinning; then
|
||||||
spop
|
spop
|
||||||
up
|
upclear
|
||||||
bol
|
|
||||||
cl
|
|
||||||
fi
|
fi
|
||||||
pen -n red "${_cross:-✗} "
|
pen -n red "${_cross:-✗} "
|
||||||
pen "$@"
|
pen "$@"
|
||||||
|
@ -195,9 +190,7 @@ export -f throw
|
||||||
warn() {
|
warn() {
|
||||||
if spinning; then
|
if spinning; then
|
||||||
spop
|
spop
|
||||||
up
|
upclear
|
||||||
bol
|
|
||||||
cl
|
|
||||||
fi
|
fi
|
||||||
pen -n yellow bold italic "${_warn:-!} "
|
pen -n yellow bold italic "${_warn:-!} "
|
||||||
pen italic "$@"
|
pen italic "$@"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# @private
|
# @private
|
||||||
|
|
||||||
_q='?'
|
readonly _q='?'
|
||||||
_a='❯'
|
readonly _a='❯'
|
||||||
_o='◌'
|
readonly _o='◌'
|
||||||
_O='●'
|
readonly _O='●'
|
||||||
_mark='✓'
|
readonly _mark='✓'
|
||||||
_warn='!'
|
readonly _warn='!'
|
||||||
_cross='✗'
|
readonly _cross='✗'
|
||||||
_spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt
|
readonly _spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt
|
||||||
|
|
||||||
export _q _a _o _O _mark _warn _cross _spinner
|
export _q _a _o _O _mark _warn _cross _spinner
|
||||||
|
|
|
@ -28,9 +28,7 @@ cl() {
|
||||||
|
|
||||||
# Clear line above
|
# Clear line above
|
||||||
upclear() {
|
upclear() {
|
||||||
up
|
up; bol; cl
|
||||||
bol
|
|
||||||
cl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print a single newline
|
# Print a single newline
|
||||||
|
|
|
@ -25,9 +25,7 @@ check() {
|
||||||
# If there is a spinner running, stop it and clear the line
|
# If there is a spinner running, stop it and clear the line
|
||||||
if spinning; then
|
if spinning; then
|
||||||
spop
|
spop
|
||||||
up
|
upclear
|
||||||
bol
|
|
||||||
cl
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pen -n green "${_mark:-✓} "
|
pen -n green "${_mark:-✓} "
|
||||||
|
|
|
@ -25,9 +25,7 @@ throw() {
|
||||||
# If there is a spinner running, stop it and clear the line
|
# If there is a spinner running, stop it and clear the line
|
||||||
if spinning; then
|
if spinning; then
|
||||||
spop
|
spop
|
||||||
up
|
upclear
|
||||||
bol
|
|
||||||
cl
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pen -n red "${_cross:-✗} "
|
pen -n red "${_cross:-✗} "
|
||||||
|
|
|
@ -25,9 +25,7 @@ warn() {
|
||||||
# If there is a spinner running, stop it and clear the line
|
# If there is a spinner running, stop it and clear the line
|
||||||
if spinning; then
|
if spinning; then
|
||||||
spop
|
spop
|
||||||
up
|
upclear
|
||||||
bol
|
|
||||||
cl
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pen -n yellow bold italic "${_warn:-!} "
|
pen -n yellow bold italic "${_warn:-!} "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue