Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.2 KiB

  1. #!/bin/sh
  2. : <<=cut
  3. =pod
  4. =head1 NAME
  5. notes - a wrapper for various things for dealing with my notes
  6. =head1 SYNOPSIS
  7. notes
  8. =head1 DESCRIPTION
  9. Some stuff for working with my notes system.
  10. =head1 LICENSE
  11. Like the rest of bpb-kit, notes is committed to the public domain.
  12. =head1 AUTHOR
  13. Brennen Bearnes <code@p1k3.com>
  14. =cut
  15. print_help() {
  16. scriptname=$(basename "$0")
  17. echo "Usage: $scriptname [command] [args]"
  18. echo " $scriptname calendar"
  19. echo " $scriptname init-metadata"
  20. echo " $scriptname links"
  21. echo " $scriptname log-index"
  22. echo " $scriptname logs-by-date"
  23. echo " $scriptname p1k3-index"
  24. echo " $scriptname pages"
  25. echo " $scriptname tag-index"
  26. echo " $scriptname tag-summary"
  27. echo " $scriptname tasks"
  28. echo " $scriptname -h Print this help message"
  29. echo
  30. echo "You must specify a command."
  31. }
  32. if [ $# -lt 1 ]; then
  33. print_help
  34. exit 1
  35. elif [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
  36. print_help
  37. exit 0
  38. fi
  39. # We should hand off to a requested subcommand:
  40. subprog="notes-$1"
  41. # Make sure that the command we've been given exists:
  42. command -v "$subprog" >/dev/null 2>&1 || {
  43. echo "notes: '$1' is not a notes command."
  44. exit 1
  45. }
  46. shift
  47. exec "$subprog" "$@"