The shell is your oyster!
Utilitily library for writing bash scripts. Think Javascripts Lodash but in Bash. This exposes some verbose functions you can use in a script to make code more readable. Supports sourcing from scripts or the shell, as well as executing scripts via the oyster shebang
Bash is powerful but its API is horrible. Oyster is for you if you are also tired of printf "%s" "${$1^^}":
# Uppercasing a string in Bash:
$ printf "%s" "${$1^^}"
# Uppercasing a string with oyster:
$ oy::str.upper "$1"A convenience install script is provided so you can directly install from the command line:
$ curl -fsSL https://github.com/thibmaek/oyster/raw/main/install.sh | bash -Download the latest release from the releases page and put somewhere on your filesystem:
$ mkdir -p /usr/local/opt/oyster
$ curl -O https://github.com/thibmaek/oyster/releases/download/v1.1.0/oyster-1.1.0.tar.gz
$ tar xvf oyster-1.1.0.tar.gz -C /usr/local/opt/oyster && cd /usr/local/opt/oyster/oyster-1.1.0
$ make installThis will install oyster in /usr/local/bin/oyster. If you have ~/bin sourced on the path you can also run make install_user to install it there.
Confirm your installation worked (after rehashing your shell):
$ oyster --version
oyster version: 1.1.0Because Oyster is a pure Bash implementation putting it in
/usr/local/binor anywhere else known to the shell PATH will merely act as a symlink under the hood. If~/.oysteris deleted, Oyster will stop working because the symlink breaks.
You can use it as a shebang in scripts. Your shell will look for oyster on the path, source all utilities and then execute your bash code just like a regular bash script with the added utilities:
#! /usr/bin/env oyster
set -e
oy::str.upper "uppercase me"If you want to bypass executing scripts via oyster you can also just source oyster's 'module' in your own scripts to make the utilities available:
#!/usr/bin/env bash
set -e
source "$(oyster --where).sh"A lot of this is prior art from the Home Assistant team. They created Bashio which provides the base modular layer that oyster also uses.
Their usage however is more steered towards creating a library for usage within Home Assistant add-ons where oyster sets itself apart as a general purpose bash scripting library.
See CONTRIBUTING.md
MIT
For more info, see license file