usage() {
  printf %s "\
$(basename "$0")
  a simple script/command/function that does something

commands:
  [d]el  [name] - Delete a password entry.
  [e]dit [name] - Edit a password entry with ${EDITOR:-vi}.
  [g]it  [cmd]  - Run git command in the password dir.
  [h]elp        - Display this message.
  [l]ist        - List all entries.
  [s]how [name] - Show password for an entry.

flags:
  -h, --help    - Display this message.

arguments:
  arg           - Describe what arg does, should be, etc.

options:
  -1|--op1      - Describe what --opt1 does.
    * op1choi2  - Describe what optionarg does.

env vars:
  password dir:     export PA_DIR=~/.local/share/pa/passwords
"
}

# exit "${1:-0}"

while test "$#" -gt 0; do
  case "$1" in
    -h | --help | --h*)
      usage
      exit 0
      ;;
    -m) # -m arg
      shift
      test "$#" -eq 0 && {
        usage 1>&2
        exit 1
      }
      shift
      ;;
    --) # stop option processing
      shift
      break
      ;;
    -*) # unknown option
      usage 1>&2
      exit 1
      ;;
    *) # first non-opt arg
      break
      ;;
  esac
done
