~dricottone/my-utils

ref: a23c8c6f5d0a77f94d184e1017caf5d1dc912e9f my-utils/src/myminiparse.sh -rwxr-xr-x 493 bytes
a23c8c6fDominic Ricottone Fixing for archive contents that have spaces in the filename 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# shellcheck disable=SC2034

# A very basic argument parser written for POSIX sh. Only supports printing
# a help message or a version number. Intended for scripts that have no good
# reason to support debugging messages.

quiet=0

for arg; do
  case "$arg" in
  -h|--help)
    /usr/bin/printf "${help_message:=git gud}\n"
    exit 0
    ;;

  -q|--quiet)
    quiet=1
    ;;

  -v|--version)
    /usr/bin/printf "${name:=my_program} ${version:=X.Y}\n"
    exit 0
    ;;
  esac
done