~dricottone/my-utils

ref: 598fcd5f3c9242b5f38809c982c7ca9045c33857 my-utils/src/myparse.bash -rwxr-xr-x 670 bytes
598fcd5fDominic Ricottone Added wg*, fw*, docker*, android*, pactl*, vimsplit; Update to enumerate 3 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

# A basic argument parser written in bash. Depends on and supplies all
# variables expected by mylib.bash. Sufficient for any script that takes
# positional arguments only.

positional=()
quiet=0
verbose=0

while [[ $# -gt 0 ]]; do
  case $1 in

  -h|--help)
    help_msg
    shift
    ;;

  -q|--quiet)
    debug_msg "Setting QUIET option to 1 (was ${quiet})"
    quiet=1
    shift
    ;;

  -v|--verbose)
    debug_msg "Setting VERBOSE option to 1 (was ${verbose})"
    verbose=1;
    shift
    ;;

  -V|--version)
    version_msg
    ;;

  *)
    debug_msg "Argument '${1}' added to positional array"
    positional+=("$1")
    shift
    ;;
  esac
done