Bash Cli Library

A framework for building Bash libraries. Originally developed in and currently used by git-bent, a wonderful wrapper for git


This library is ready to use, but the documentation has issues due to an old development dependecy.

Why Use this over others?

  • Easy to get started
  • Fairly minimal
  • Nice help menus for your library
  • Convenience Functions - see doc/
  • You like how git-bent works and want a library like it


This is the actual code executed to setup new bash libraries with ./bash-cli setup. step is one of our built-in functions.

Template 'core_setup' does not exist.  

Set up a new library

  1. cd to the root of the new library.
  2. git clone @git(https_url) vendor/bash-cli
  3. ./vendor/bash-cli/bash-cli setup new project
  4. Follow the prompts. Then source ~/.bashrc or re-launch your terminal.
  5. Look at the sample code in your new library
  6. Run yourlib help or ./bin/yourlib help
  7. Write a couple functions & run them to get a sense of how things work.

Development tools (optional, recommended)

We use code-scrawl, a Php package, to generate help menus and documentation. You caaaaan write help menus manually.

To use the tools, we require Php & Composer (Php's popular package manager). Php is only required for development. Your bash library's users will not need Php.

  1. howto/install-php
  2. howto/install-composer
  3. cd vendor/bash-cli; composer install; - installs Code Scrawl and its dependencies.
  4. cd ../.. (back to your project root) then vendor/bash-cli/bash-cli scrawl
    • The help menus have been re-generated, as well as documentation
  5. You may want to edit .config/scrawl.json inside your project to your liking.
  6. See php/code-scrawl for more info on documentation generation.


Alternatives / Competition

  • Bash-it: "Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work"
  • Bash OO Framework: "Bash Infinity transforms the often obfuscated "bash syntax" to a cleaner, more modern syntax"
  • Bashinator: "Bashinator is a framework for bash shell scripts."
  • (old List of Bash Scripting Libraries) or WebArchive Link


  • I have no idea if this works on Windows with WSL or git bash. It probably works on Mac. I use Linux. You can submit PRs for compatibility with different systems


If you want to contribute, you do not need php. I will gladly run the documentation generation myself & eventually will do this with CICD.

This uses PHP packages to generate documentation & help menus. This requires composer (to install dependencies), php language, and I'm pretty sure composer requires git, but you probably have that already

To setup the dev environment, make a fork, then:

git clone git-bent # Put in the correct url for your fork.  
cd git-bent/.config  
composer install  
cd ..  

Then to generate documentation & help menus:


& just answer 'y'