bash script / project creator
to create a new stand-alone SCRIPT (just a xyz.sh script), with option parsing, color output (cf
to create a new standalone script PROJECT (in a folder, with README) (cf
to initialize a bashew-based REPO with CI/CD you just cloned (cf
- contained in 1 single file (no external dependencies)
- comes with
CHANGELOG.md, ... markdown files
- edit only main() function and subroutines in beginning of script, all template code is at the end of the script
- definition of flags/options/parameters in 1 place only
- definition of dependencies (like curl, ffmpeg, imagemagick...) in 1 place only
- automatic creation of usage text based on definition above
- short/long option parsing, based on definition above
- several functions for output to stdout/stderr, with intelligent color usage (not when output is piped)
- reads a .env configuration file, if there is one
- predefined quiet (no output) and verbose (more output) modes
- folder for temporary files (with automatic cleanup)
- folder for log files (with automatic cleanup)
- easy CI/CD for Github (with shellcheck)
- correct determination of script installation folder (resolve symbolic links)
- see features.md for detailed information
Program: bashew 1.16.8 by [email protected] Updated: Dec 17 21:28:04 2021 Description: package_description Usage: bashew [-h] [-q] [-v] [-f] [-l <log_dir>] [-t <tmp_dir>] [-n <name>] <action> Flags, options and parameters: -h|--help : [flag] show usage [default: off] -q|--quiet : [flag] no output [default: off] -v|--verbose : [flag] output more [default: off] -f|--force : [flag] do not ask for confirmation (always yes) [default: off] -l|--log_dir <?> : [option] folder for debug files [default: /Users/pforret/log/bashew] -t|--tmp_dir <?> : [option] folder for temp files [default: /tmp/bashew] -n|--name <?> : [option] name of new script or project <action> : [parameter] action to perform: script/project/init/update
1. create new bash script (without repo)
bashew.sh script # will interactively ask for author & script details bashew.sh -f script # will create new script with random name bashew.sh -f -n "../list.sh" script # will create new script ../list.sh
$ bashew.sh -f script … Creating script ./towel_nappers.sh ... ./towel_nappers.sh $ bashew.sh -f -q script ./iffiest_prepays.sh
2. create new bash project folder/repo (with README.md, CI/CD)
bashew.sh project # will interactively ask for author & script details bashew.sh -f project # will create new project with random name bashew.sh -f -n "tango" project # will create new project in folder "tango"
> bashew.sh -f project … Creating project ./tendon_mingle ... CHANGELOG.md README.md VERSION.md LICENSE .gitignore tendon_mingle.sh bitbucket-pipelines .github/workflows ✔ next step: 'cd ./tendon_mingle' and start scripting!
3. create a bash script repo, with CI/CD, with README, with tests, with versioning ...
- on github.com/pforret/bashew, click on 'Use this template'
- then clone your new repo
git clone https://github.com/<you>/<your repo>.git cd <your repo> ./bashew.sh init # will ask for details and initialise/clean up the repo
setver push # will commit and push new code setver new patch # will set new version to 0.0.1 setver set 1.0.0 # when your first working version is committed
4. git clone into new repo
git clone --depth=1 https://github.com/pforret/bashew.git <newname> cd <newname> ./bashew.sh init # will ask for details and iniialise/clean up the repo
git clone https://github.com/pforret/bashew.git ln -s bashew/bashew.sh /usr/local/bin
- or with basher package manager
basher install pforret/bashew
- bash_unit: bash unit testing enterprise edition framework (used for CI/CD)
- shellcheck: a static analysis tool for shell scripts (used for CI/CD)
- bash-boilerplate (2012) on which I based my bash-boilerplate (2020) which eventually became this bashew
- Bash documentation from Google, BashPitfalls, Microsoft
What's that name? Bashew?
- derived from 'bash new'
- rhymes with cashew