#!/bin/sh : <<=cut =pod =head1 NAME notes - a wrapper for various things for dealing with my notes =head1 SYNOPSIS notes =head1 DESCRIPTION Some stuff for working with my notes system. =head1 LICENSE Like the rest of bpb-kit, notes is committed to the public domain. =head1 AUTHOR Brennen Bearnes =cut print_help() { scriptname=$(basename "$0") echo "Usage: $scriptname [command] [args]" echo " $scriptname calendar" echo " $scriptname init-metadata" echo " $scriptname links" echo " $scriptname log-index" echo " $scriptname logs-by-date" echo " $scriptname p1k3-index" echo " $scriptname pages" echo " $scriptname tag-index" echo " $scriptname tag-summary" echo " $scriptname tasks" echo " $scriptname -h Print this help message" echo echo "You must specify a command." } if [ $# -lt 1 ]; then print_help exit 1 elif [ "$1" = "--help" ] || [ "$1" = "-h" ]; then print_help exit 0 fi # We should hand off to a requested subcommand: subprog="notes-$1" # Make sure that the command we've been given exists: command -v "$subprog" >/dev/null 2>&1 || { echo "notes: '$1' is not a notes command." exit 1 } shift exec "$subprog" "$@"