Initial commit - v1.0

This commit is contained in:
Manuele Sarfatti 2025-05-09 20:01:43 +02:00
commit 76d136f64c
20 changed files with 1350 additions and 0 deletions

38
src/02.ui/throw.sh Normal file
View file

@ -0,0 +1,38 @@
#! /usr/bin/env bash
# throw.sh - Print an throw message
# @depends on:
# - pen.sh
# - movements.sh
# - _symbols.sh
# Print an throwmark with a message, and stop and replace the
# spinner if it's running (relies on the spinner being the last
# thing printed)
#
# Usage:
# throw [options] text
# Options:
# [same as pen.sh]
# Examples:
# throw "Failed, world!"
# throw bold "Failed, world!"
# --or--
# spin "Installing dependencies..."
# sleep 2
# throw "Did you forget to feed the cat?"
throw() {
# If there is a spinner running, stop it and clear the line
if spinning; then
spop
up
bol
cl
fi
pen -n red "${_cross:-} "
pen "$@"
}
# Export the throw function so it can be used in other scripts
export -f throw