WebDev-Friendly Approach to Bash scripting, with Sh:erpa
Sh:erpa brings Cargo, OhMy' and WebDev worflow to Bash scripting, using the Terminal as a browser! Because WebDevs should be able to do more than npm run dev in a terminal, and Bash lovers don't have to be reduced to automations writers, obviously because I like both sides. Docs: sherpa-cli.netlify.app - Discord: Community Discord Server JavaScript, PHP, Rust and other languages can indeed generate CLI tools with shell-like approaches, nevertheless Bash actually IS a shell, handling everything as expected. What the other languages often have is better tooling around, making for a nicer developer experience. Sh:erpa's goal is to be that tool, simplifying the creation of scripts & libraries and helping non-devs actually installing and using them. It's just a beginning, the imagination is the limit. Note: First time i'm talking about, so really need feedback

Sh:erpa brings Cargo, OhMy' and WebDev worflow to Bash scripting, using the Terminal as a browser!
Because WebDevs should be able to do more than npm run dev
in a terminal, and Bash lovers don't have to be reduced to automations
writers, obviously because I like both sides.
Docs: sherpa-cli.netlify.app - Discord: Community Discord Server
JavaScript, PHP, Rust and other languages can indeed generate CLI tools with shell-like approaches, nevertheless Bash actually IS a shell, handling everything as expected. What the other languages often have is better tooling around, making for a nicer developer experience.
Sh:erpa's goal is to be that tool, simplifying the creation of scripts & libraries and helping non-devs actually installing and using them. It's just a beginning, the imagination is the limit.
Note: First time i'm talking about, so really need feedback <3
Quick install
Be sure to have Bash, curl, gawk instaled, then run the installer:
bash -c "$(curl -sLo- https://sherpa-cli.netlify.app/install.sh)"
It will do the following:
- A. Install the CLI tools if not already installed.
- B. Clone the Sh:erpa repo as ~/.sherpa
- C. Add to the $PATH ~/.sherpa/bin
- D. Initiate the SherpaCustomDir as ~/sherpa
Use a Linux Distribution, still a Linux Distro but from WSL2 or MacOS. For good measure once installed, you can run sherpa self-update
to re-generate the executable.
See the docs for more details.
The BashBox (think Crate) Anatomy
When running: sherpa new myScript
the following is generated:
# /home/user/sherpa/boxes/myScript
.
├── data
│ └── file.yaml
├── docs
│ └── myScript.md
├── README.md
├── Sherpa.yaml
├── src
│ ├── bin.sh
│ ├── _globals.sh
│ ├── _header.sh
│ ├── _lib.sh
│ ├── _options.sh
│ └── __paths.txt
├── target
│ └── local
│ └── myScript
└── tests
└── example_test.sh
Looks familiar? A simple src/bin.sh
file could look like that:
use "std/fmt"
main() {
# Data
dude="$(dataGet "hiker" "name")"
# Template
h1 "Greetings adventurer :)"
hr "+" "-" # ------+------
br
p "Welcome ${txtBlue} ${dude} ${x}!"
}
# Main Route. Script called with no arguments
[[ "$#" == 0 ]] && main; exit 0
Sh:erpa will merge the partials plus those sourced with use "dir/file"
, generate docs, remove comments and blanks, then build the script and make it available for direct invocations and eventually re-build on files save.
The tool can be picked-up by WebDevs discovering Bash or experienced shell scripters taking advantage of the build, watch and organisation or distribution, while writing things their own way.
The docs website will get soon a Ressources section, with cheat-sheets, examples and other helpful things to kick off projects.
Local Libraries
To create your own local library, use something as sherpa new bob lib
. This would scafold a library version of a BashBox in /home/user/sherpa/lib
with that structure:
# home/user/sherpa/lib/bob
.
├── data
│ └── example.yaml
├── lib.sh
├── README.md
├── Sherpa.yaml
└── tests
└── example_test.sh
Any .sh file in bob/
can be imported in any BashBox with use "bob/fileName"
.
Install community-made packages
So far, we can install remote BashBoxes or Libs from Git repositories with:
- BashBox:
sherpa install -n "
" -u " " - BashLib:
sherpa install -n "
" -u " " -t "lib"
More details in the Documentation, and some available repos to play with soon listed, so stay tuned or comme say hi.
Features
Check the Sh:erpa Website or come talk in the Discord, but some included features are:
- Modular + build-step workflow
- Pug-like semantic formating
- Non verbose styling options
- CRUD operations on .yaml files
- Fetch API data and use JSON in Bash
- CDN-like imports for remote Libs
- Integrated UnitTests suite
- Docs generation from comments
- Install/Up/Remove remote BashBox or Lib
- Source local libs with
use "dir/file"
- Helpers for env variables or package data
- Helper for
Are you sure? (y/n)
confirm - ...to name some of them.