A simple bash module to display progress bars and spinners, using the ascii-advanced and optionally utf-8 symbols.
◉━◉━◉━◉◯◯◯◯◯ 40%
Readme for BashProg
- git readme houses build details and basic usage
- gitlab pages house the full documentation
- Generate progress-bars and spinners
- Supports multiple spinners and progress-bars themes running in parallel.
- Theme files are cached in memory on theme load to improve performance, and minimize the number of times the theme file is read from disk.
- Supports
24-bitcolor ranges - Supports
256-bitcolor ranges with optional flag--c256, most modern terminals support 256 but not all. - Supports multiple themes
- Supports custom themes via JSON files
jqcommand line tool (https://stedolan.github.io/jq/)bashv5.7 or higher
Clone the repo and source the bashprog.sh.
# clone the repo to your local machine
git clone https://github.com/sgkens/bprog.git
cd froglet
# source the bashprog.sh entry file
source /path/to/bprog/bashprog.shBuild the bashprog script by running the build.sh script.
⚗️ Output a progress bar using the braille theme.
# long form
bashprog --bar --theme braille 75 30
# short form
bashprog -b -t braille 75 30🔻 Output:
◉━◉━◉━◉◯◯◯◯◯ 40%
⚗️ Output a progress bar with the braille theme add barcolor and barbgcolor.
bashprog -b -t braille -p 75 -w 30 -bc red -bbg black⚗️ Output a progress bar with all options
bprog -b -t braille -p 75 -w 30 \
-bc red -bbg black -ptc green -bop white -bco blue -pc yellow -v⚗️ Output a spinner with the bits theme
bprog -s -t bits -m "Loading..."⚗️ Output a spinner with the bits theme with spinnercolor
bprog -s -t bits -m "Loading..." -sc red⚗️ Output a spinner with all options
bprog -s -t bits -m "Loading..." -sc red -vBashprog has three modes: Bar, Spinner, and Demo.
▫️ Bar mode is used to display progress bars --bar.
▫️ Spinner mode is used to display spinners --spinner.
▫️ Demo mode is used to display a demo of the spinner and bar themes --demomode.
--debug is used to enable debug mode. This will output debug messages to the console.
bashprog --bar braille 75 30 --debug --demoModes -> Bar, Spinner, Demo Themes -> Bar, Spinner
Logic
- set local variable for $MODE, $TYPE, $THEME
- switch case for $MODE
- switch case inside of switch case for $TYPE
bashprog [options] [theme] [[percent] [width] [message] | [message]] options: -h, --help Display this help message -d, --debug Debug mode -b, --bar Display a progress bar -s, --spinner Display a spinner -t, --theme Theme name -dm, --demomode Demo mode -bc, --barcolor Bar color -bbg, --barbgcolor Bar background color -ptc, --pointercolor Pointer color -bop, --baropencolor Bar open color -bco, --barclosecolor Bar close color -pc, --percentcolor Percent color -v, --verbose Verbose mode -d, --debug Debug mode
Theme files are in the format of a JSON Object and are located in the themes directory. themes consist of mostly ASCII+Advanced characters and some utf-8 symbols with some mixed together.
Bar themes are located in the themes/bars directory and are named themename.json.
🐦 Note!
open,close,complete,incomplete,descriptionare not required properties.❗themeis a required property