Installing a BashBox

The BashBoxRegistry in the making

The center of everything great is the ability to share and mutualize what we are creating, building that way something ...together.

Each BashBox that we are publishing on a git platform, library or executable script can be installed with one command by other Bash hikers from the Sh:erpa community and enjoy it or using it to build another BashBox.

Installing a BashBox Script

There will be a shorter form at some point later, such as s install <boxName>, but until then we can already install BashBoxes using three flags. -n with a short name that will be used in commands like s uninstall <boxName>, -t for Type (bin or lib) defaulting to 'bin', and finally -u with the repository's URL from where we'll clone the source.

sherpa install -n "fromSource" -u "https://github.com/user/repo"

This will clone the BashBox inside ${SCD}/bbr/bin, move inside and run sherpa build. The script will be built from the files in src/, saved in target/local/ and symlinked to ~/.sherpa/bin. Ready to be invoked and used via the fromSource command.

When running sh for the Dashboard recap, it will be listes as a Remote box, with it's name and the executable name we can now call directly.

fromSource

Installing a BashBox Library

As the -t flag defaults to bin, this time we'll need to specify it, with a value of lib. That way, Sh:erpa will treat the content of that repository differently, as it doesn't need a build-step.

sherpa install -n "icons" -t "lib" -u "https://github.com/user/repo"

This will clone the repository, place it inside the ${SCD}/bbr/lib directory and create a symlink into the ${SCD}/lib directory, where Sh:erpa is looking for libraries to load.

We can now use that new ressource as per usual:

# some/BashBox/src/bin.sh

use "icons/FontAwesome"

main() {
  h1 "${icoStar} Awesome Title"
}

Removing a Box or a Lib

If for any good reason you need to uninstall something you get from git, just run the uninstall command.

# /from/anywhere

# Remove a remote BashBox
sherpa uninstall <boxName>

This command will remove the directories, symplinks and registers entries.

BBR, the BashBoxRegistry

If great pieces of code or fun little things are scattered around the git platforms and making it difficult to find/browse, it would be a wasteful of opportunities.

To organize discoverability and facilitate the building-up of the BashBoxes eco system, we will find a way to regroup/promote those projects and implement a sherpa search or just a listing to begin with. Our little "crates" directory.

Some BashBoxes examples

Projects that can be used, play-with or serve as a template to make your own ones. If you have one, feel free to porpose it for inclusion on that list:

  • PacaMan: List PackageManagers, dirs and --global packages.
  • AskAI: Sending a search query to PerplexityAI, from the terminal.
  • Appwrite CRUD: Demo of a CLI Appwrite CRUD implementation.
  • Appwrite Lib: The library used in the Appwrite CRUD Bashbox.