saturnin.skel 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. . <(ffoom init)
  3. export FFOO_INI_PATH="$SATURNIN_INI_PATH:__SATURNIN_INI_PATH__"
  4. export FFOO_PATH="__SATURNIN_FFOO_PATH__"
  5. saturnin_libexec="__SATURNIN_LIBEXEC__"
  6. ffoo import exit
  7. ffoo import core
  8. usage() {
  9. usage_is "[-d|-v] command [args...]" \
  10. "help"
  11. }
  12. print_help() {
  13. echo "valid commands:"
  14. echo ""
  15. ls "$saturnin_libexec" \
  16. | sed -e 's/saturnin-/ /'
  17. }
  18. while true; do case $1 in
  19. -d|--debug) export FFOO_DEBUG=true; shift ;;
  20. -v|--verbose) export FFOO_VERBOSE=true; shift ;;
  21. --) shift; break ;;
  22. "") usage; ;;
  23. *) break; ;;
  24. esac done
  25. debug "\$@=$@"
  26. scmd=$1
  27. shift
  28. case $scmd in
  29. help) print_help; exit $FFOO_EXIT_OK ;;
  30. *)
  31. lexpath="$saturnin_libexec/saturnin-$scmd"
  32. debug -v lexpath
  33. debug "\$@='$@'"
  34. test -x "$lexpath" && exec "$lexpath" "$@"
  35. warn "invalid sub-command: $scmd"
  36. print_help; exit $FFOO_EXIT_USAGE
  37. ;;
  38. esac