saturnin.skel 1.1KB

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