taeluf / bash.cli-framework
A bash cli framework for developing easy-to-use command line libraries
Requires
- taeluf/code-scrawl: v0.8.x-dev
This package is auto-updated.
Last update: 2024-10-25 03:30:58 UTC
README
Bash Cli Library
A framework for building Bash libraries. Originally developed in and currently used by git-bent, a wonderful wrapper for git
Notice
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/Functions.md
- You like how git-bent works and want a library like it
Example
This is the actual code executed to setup new bash libraries with ./bash-cli setup
. step
is one of our built-in functions.
Cannot find 'core_setup' part of 'core_setup' on 'function'. You may try one of:
Set up a new library
cd
to the root of the new library.git clone @git(https_url) vendor/bash-cli
./vendor/bash-cli/bash-cli setup new project
- Follow the prompts. Then
source ~/.bashrc
or re-launch your terminal. - Look at the sample code in your new library
- Run
yourlib help
or./bin/yourlib help
- 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.
- howto/install-php
- howto/install-composer
cd vendor/bash-cli; composer install;
- installs Code Scrawl and its dependencies.cd ../..
(back to your project root) thenvendor/bash-cli/bash-cli scrawl
- The help menus have been re-generated, as well as documentation
- You may want to edit
.config/scrawl.json
inside your project to your liking. - See php/code-scrawl for more info on documentation generation.
Connect
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
Notes
- 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
Development
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@gitlab.com:your_vendor_name/bash/git-bent.git git-bent # Put in the correct url for your fork.
cd git-bent/.config
composer install
cd ..
Then to generate documentation & help menus:
vendor/taeluf/code-scrawl/cli/scrawl
& just answer 'y'