diff --git a/Makefile b/Makefile index cff2012..9fed9f3 100644 --- a/Makefile +++ b/Makefile @@ -27,14 +27,15 @@ demo: build $(OUTPUT): $(ALL_SRC_FILES) @mkdir -p $(OUT_DIR) - @echo '#! /usr/bin/env bash' > $(OUTPUT) + @echo '#!/usr/bin/env bash' > $(OUTPUT) @echo '# shellcheck disable=all' >> $(OUTPUT) @echo '#' >> $(OUTPUT) @echo '# beddu.sh - A lightweight bash framework for interactive scripts and pretty output' >> $(OUTPUT) @echo '# https://github.com/mjsarfatti/beddu' >> $(OUTPUT) @echo '#' >> $(OUTPUT) + @echo '# Version: $(shell git describe --tags --dirty)' >> $(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 \ echo "" >> $(OUTPUT); \ grep -v '^\s*#' "$$file" | sed '/^[[:space:]]*$$/d' | sed 's/#[a-zA-Z0-9 ]*$$//' >> $(OUTPUT); \ diff --git a/build/beddu.sh b/build/beddu.sh index e028fc6..13c7dc6 100755 --- a/build/beddu.sh +++ b/build/beddu.sh @@ -1,19 +1,20 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # shellcheck disable=all # # beddu.sh - A lightweight bash framework for interactive scripts and pretty output # 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='?' -_a='❯' -_o='◌' -_O='●' -_mark='✓' -_warn='!' -_cross='✗' -_spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt +readonly _q='?' +readonly _a='❯' +readonly _o='◌' +readonly _O='●' +readonly _mark='✓' +readonly _warn='!' +readonly _cross='✗' +readonly _spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt export _q _a _o _O _mark _warn _cross _spinner up() { @@ -32,9 +33,7 @@ cl() { printf "\033[2K" } upclear() { - up - bol - cl + up; bol; cl } line() { printf "\n" @@ -118,9 +117,7 @@ export -f run check() { if spinning; then spop - up - bol - cl + upclear fi pen -n green "${_mark:-✓} " pen "$@" @@ -183,9 +180,7 @@ export -f spin spop spinning throw() { if spinning; then spop - up - bol - cl + upclear fi pen -n red "${_cross:-✗} " pen "$@" @@ -195,9 +190,7 @@ export -f throw warn() { if spinning; then spop - up - bol - cl + upclear fi pen -n yellow bold italic "${_warn:-!} " pen italic "$@" diff --git a/src/00.utils/_symbols.sh b/src/00.utils/_symbols.sh index 78e0fc8..cafbae5 100644 --- a/src/00.utils/_symbols.sh +++ b/src/00.utils/_symbols.sh @@ -1,13 +1,13 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # @private -_q='?' -_a='❯' -_o='◌' -_O='●' -_mark='✓' -_warn='!' -_cross='✗' -_spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt +readonly _q='?' +readonly _a='❯' +readonly _o='◌' +readonly _O='●' +readonly _mark='✓' +readonly _warn='!' +readonly _cross='✗' +readonly _spinner='⣷⣯⣟⡿⢿⣻⣽⣾' # See for alternatives: https://antofthy.gitlab.io/info/ascii/Spinners.txt export _q _a _o _O _mark _warn _cross _spinner diff --git a/src/00.utils/movements.sh b/src/00.utils/movements.sh index f2c289f..e759b68 100644 --- a/src/00.utils/movements.sh +++ b/src/00.utils/movements.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # movements.sh - Cursor helper functions # Move cursor up one line @@ -28,9 +28,7 @@ cl() { # Clear line above upclear() { - up - bol - cl + up; bol; cl } # Print a single newline diff --git a/src/01.core/pen.sh b/src/01.core/pen.sh index a9c5bf3..1d60547 100644 --- a/src/01.core/pen.sh +++ b/src/01.core/pen.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # pen.sh - Print pretty text # @depends on: diff --git a/src/01.core/run.sh b/src/01.core/run.sh index 5e34466..b4e9c30 100644 --- a/src/01.core/run.sh +++ b/src/01.core/run.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # run.sh - Execute commands with output/error capture # Execute a command with stdout and stderr capture capabilities diff --git a/src/02.ui/check.sh b/src/02.ui/check.sh index d2a3f5d..d676a28 100644 --- a/src/02.ui/check.sh +++ b/src/02.ui/check.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # check.sh - Print a success message # @depends on: @@ -25,9 +25,7 @@ check() { # If there is a spinner running, stop it and clear the line if spinning; then spop - up - bol - cl + upclear fi pen -n green "${_mark:-✓} " diff --git a/src/02.ui/repen.sh b/src/02.ui/repen.sh index c21641d..b0afa73 100644 --- a/src/02.ui/repen.sh +++ b/src/02.ui/repen.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # repen.sh - Overwrite the previous line with new text # @depends on: diff --git a/src/02.ui/spin.sh b/src/02.ui/spin.sh index 007903a..5fd8384 100644 --- a/src/02.ui/spin.sh +++ b/src/02.ui/spin.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # spin.sh - Print a spinner with a message # @depends on: diff --git a/src/02.ui/throw.sh b/src/02.ui/throw.sh index bf21e9a..44af460 100644 --- a/src/02.ui/throw.sh +++ b/src/02.ui/throw.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # throw.sh - Print an throw message # @depends on: @@ -25,9 +25,7 @@ throw() { # If there is a spinner running, stop it and clear the line if spinning; then spop - up - bol - cl + upclear fi pen -n red "${_cross:-✗} " diff --git a/src/02.ui/warn.sh b/src/02.ui/warn.sh index 06d5d55..91e4b46 100644 --- a/src/02.ui/warn.sh +++ b/src/02.ui/warn.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # warn.sh - Print a warning message # @depends on: @@ -25,9 +25,7 @@ warn() { # If there is a spinner running, stop it and clear the line if spinning; then spop - up - bol - cl + upclear fi pen -n yellow bold italic "${_warn:-!} " diff --git a/src/03.prompt/ask.sh b/src/03.prompt/ask.sh index b96b0bf..b8c4a47 100644 --- a/src/03.prompt/ask.sh +++ b/src/03.prompt/ask.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # ask.sh - Get free text input from the user # @depends on: diff --git a/src/03.prompt/choose.sh b/src/03.prompt/choose.sh index 58fbea8..9799f8e 100644 --- a/src/03.prompt/choose.sh +++ b/src/03.prompt/choose.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # choose.sh - Choose from a menu of options # @depends on: diff --git a/src/03.prompt/confirm.sh b/src/03.prompt/confirm.sh index 6d167f3..b8b366e 100644 --- a/src/03.prompt/confirm.sh +++ b/src/03.prompt/confirm.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash # confirm.sh - Read a yes/no confirmation from the user # @depends on: