saturnin.skel 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. -*) usage; ;;
  22. --*) usage; ;;
  23. --) shift; break ;;
  24. "") usage; ;;
  25. *) break; ;;
  26. esac done
  27. debug "\$@=$@"
  28. scmd=$1
  29. shift
  30. case $scmd in
  31. help) print_help; exit $FFOO_EXIT_OK ;;
  32. *)
  33. lexpath="$saturnin_libexec/saturnin-$scmd"
  34. debug -v lexpath
  35. debug "\$@='$@'"
  36. test -x "$lexpath" && exec "$lexpath" "$@"
  37. warn "invalid sub-command: $scmd"
  38. print_help; exit $FFOO_EXIT_USAGE
  39. ;;
  40. esac