#!/bin/bash . <(ffoom init) export FFOO_INI_PATH="$SATURNIN_INI_PATH:__SATURNIN_INI_PATH__" export FFOO_PATH="__SATURNIN_FFOO_PATH__" saturnin_libexec="__SATURNIN_LIBEXEC__" ffoo import exit ffoo import core usage() { usage_is "[-d|-v] command [args...]" \ "help" } print_help() { echo "valid commands:" echo "" echo " czrates" echo " dmenu" echo " iam" echo " ini" echo " ip" echo " ln" echo " push" echo " revert" echo " watch" echo " www" } while true; do case $1 in -d|--debug) export FFOO_DEBUG=true; shift ;; -v|--verbose) export FFOO_VERBOSE=true; shift ;; --) shift; break ;; "") usage; ;; *) break; ;; esac done debug "\$@=$@" scmd=$1 shift case $scmd in help) print_help; exit $FFOO_EXIT_OK ;; *) lexpath="$saturnin_libexec/saturnin-$scmd" debug -v lexpath debug "\$@='$@'" test -x "$lexpath" && exec "$lexpath" "$@" warn "invalid sub-command: $scmd" print_help; exit $FFOO_EXIT_USAGE ;; esac