🗃️ archived for https://github.com/arg-sh/argsh
Create simple and short shell (bash) scripts with ease. argsh
takes away the
tedious work to create your own argument parser and keeps your shell usage at bay.
- to be able to use argsh scripts on your system, it makes sense to install it globally
# manually
git clone https://github.com/fentas/argsh.git
cd argsh/bin
suod ln -sf argsh /usr/local/bin
- Describe your arguments and
argsh
does the rest.
touch <your-script-name>
sudo chmod +x <your-script-name>
#!/usr/bin/env argsh
set -eu -o pipefail
# OPTIONS
# argsh(t|test-option): env(TEST_OPTION) def(false) des(A test option.) val()
# ACTIONS
# PATHS
# VARIABLES
# IMPORTS
# MAIN
main() {
# dependencies
# actions
for ACTION in ${ARGSH_ACTIONS}; do case "${ACTION}" in
T|test-action) test_action ;;
esac; done
}
# FUNCTIONS
test_action() {
echo "$TEST_OPTION"
}
# VALIDATORS
# RUN
[[ "${0}" != "${BASH_SOURCE[0]}" ]] || main "${@}"
Follow up.
Folder structure is right out copied from https://github.com/bats-core/bats-core. Also is bats used for testing. Big thanks for that.