Raclette/raclette-run

49 lines
1,019 B
Bash
Executable file

#!/usr/bin/env bash
readonly PKGVER="0.0.1"
readonly LICENSE="GNU AGPLv3"
readonly ROOTPATH="$(dirname $(readlink -f $(which ${0})))"
function usage() {
cat << EOF
Usage: $(basename ${0}) [options] <function> [arguments]
$(basename $0) is the frontend command for executing Raclette Runners. Raclette Runners are
modules used to execute convenience functions on the Raclette Master
Options:
--version show program's version number and exit
-h, --help show this help message and exit
EOF
}
function version() {
cat << EOF
Raclette v${PKGVER}
Copyright (C) 2024 Noveria Network
This program may be freely redistributed under
the terms of the ${LICENSE}
EOF
}
###
## SCRIPT START
###
while [[ $# -gt 0 ]]; do
case "$(echo $1 | cut -d. -f1)" in
-h|--help)
usage
exit 0
;;
fileserver)
command="${1/./_}" # replace dot . with underscore _
break
;;
esac
shift
done
source ${ROOTPATH}/functions/run/$(echo "$command" | cut -d_ -f1)
$command