saturnin.skel 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. echo " czrates"
  16. echo " dmenu"
  17. echo " iam"
  18. echo " ini"
  19. echo " ip"
  20. echo " ln"
  21. echo " push"
  22. echo " revert"
  23. echo " watch"
  24. echo " www"
  25. }
  26. while true; do case $1 in
  27. -d|--debug) export FFOO_DEBUG=true; shift ;;
  28. -v|--verbose) export FFOO_VERBOSE=true; shift ;;
  29. --) shift; break ;;
  30. "") usage; ;;
  31. *) break; ;;
  32. esac done
  33. debug "\$@=$@"
  34. scmd=$1
  35. shift
  36. case $scmd in
  37. help) print_help; exit $FFOO_EXIT_OK ;;
  38. *)
  39. lexpath="$saturnin_libexec/saturnin-$scmd"
  40. debug -v lexpath
  41. debug "\$@='$@'"
  42. test -x "$lexpath" && exec "$lexpath" "$@"
  43. warn "invalid sub-command: $scmd"
  44. print_help; exit $FFOO_EXIT_USAGE
  45. ;;
  46. esac