A simple CLI script for wrapping Bash scripts in a single command.
I created this template project because I wanted to have a simple CLI wrapper for some of my other projects.
So this could be useful for any project which wants to ship a single entrypoint script to a bunch of different scripts.
- A simple
cli.shscript which handles displaying a list of commands, help information and running scripts as sub-commands. - Builtin
listandhelpsub-commands. - Any
.shscripts in thecommandsdirectory will be registered automatically as sub-commands. - Scripts in the
commandsdirectory can also provide a.help.txtfile which is displayed when running thehelpsub-command, and the first line of the file is used as the description in the commandlist. - Most existing Bash scripts will work as is, no special functions are needed, scripts are sourced and invoked arguments are shifted before command script is sourced, so
$2becomes$1for the command script. - Formatting variables for
RESETREDGREENYELLOWBLUEare provided. - The
cli.shscript supports being run from anywhere in the system. For example, this means it can be symlinked to/usr/binand it will work.
Read the CLI docs for more information on how commands works.
- Start by copying the contents of this repository to your project. However, you probably won't want this
README.md. - You may want to rename the
cli.shscript, or leave the name as is, it doesn't matter what the name is, as long as any references in the.github,docsandtestsdirectory are also updated. - Consider adding something like the following section to your own
README.md
To install the CLI, create a symlink: `ln -s cli.sh /usr/bin/cli`