mirror of
https://github.com/mjsarfatti/beddu.git
synced 2025-06-26 17:08:01 +02:00
Initial commit - v1.0
This commit is contained in:
commit
76d136f64c
20 changed files with 1350 additions and 0 deletions
38
src/02.ui/throw.sh
Normal file
38
src/02.ui/throw.sh
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue