Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate tests/common.t @ 811:32e457ff872f
common.subr: Format of JQ definition
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 08 Nov 2024 11:59:47 +0100 |
| parents | 6cf3e1021862 |
| children |
| rev | line source |
|---|---|
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 Basic tests of common.subr |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 Shell is /bin/sh. |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 Setup |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 ===== |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 $ set -u |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 $ . "${TESTDIR}/testsetup.sh" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 $ _p_datadir="${TESTDIR}/../share/local-bsdtools" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 $ . "${_p_datadir}/common.subr" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 Getopts |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 ======= |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 Normal successfull calls |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 > opt_a=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 > opt_b=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 > unset opt_b_val |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 > OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
25 > while getopts "ab:-:" opt --long-a --long-b=value-of-b arg ; do |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-b=value-of-b arg |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
27 > case "$opt" in |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
28 > a|long-a) opt_a=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
29 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
30 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
31 > b|long-b) opt_b=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
33 > opt_b_val="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
35 > \?) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 > error=foo |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 > *) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 > error=bar |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 > esac |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 > done |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
43 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 $ checkyesno opt_a |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
45 $ checkyesno opt_b |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
46 $ [ "${opt_b_val}" = "value-of-b" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
47 $ [ -z "${error}" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
48 |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
49 Not null-terminated long options specifications |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
50 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 $ OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
52 > getopts "ab:-:" opt --long-a --long-b arg |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
53 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
54 /bin/sh: ERROR: Missing null terminator for long option specifications |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
55 [64] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
56 $ [ -z "${opt}" ] |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
57 $ [ -z "${OPTARG+SET}" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
58 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
59 Not null-terminated long options specs (alternate error handling) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
60 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
61 $ OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
62 > getopts ":ab:-:" opt --long-a --long-b arg |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
63 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b" |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
64 /bin/sh: ERROR: Missing null terminator for long option specifications |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
65 [64] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
66 $ [ -z "${opt}" ] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
67 $ [ -z "${OPTARG+SET}" ] |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
68 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
69 Illegal long option |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
70 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
71 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
72 > opt_a=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
73 > opt_b=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
74 > unset opt_b_val |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
75 > OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
76 > while getopts "ab:-:" opt --long-unknown ; do |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
77 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-unknown |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
78 > case "$opt" in |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
79 > a|long-a) opt_a=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
80 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
81 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
82 > b|long-b) opt_b=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
83 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
84 > opt_b_val="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
85 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
86 > \?) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
87 > error=foo |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
88 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
89 > *) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
90 > error=bar |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
91 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
92 > esac |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
93 > done |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
94 /bin/sh: ERROR: Illegal option --long-unknown |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
95 $ [ "${error}" = "foo" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
96 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
97 Illegal long option (alternate error handling) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
98 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
99 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
100 > opt_a=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
101 > opt_b=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
102 > unset opt_b_val |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
103 > OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
104 > while getopts ":ab:-:" opt --long-unknown ; do |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
105 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b=" "" --long-unknown |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
106 > case "$opt" in |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
107 > a|long-a) opt_a=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
108 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
109 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
110 > b|long-b) opt_b=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
111 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
112 > opt_b_val="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
113 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
114 > \?) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
115 > error="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
116 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
117 > *) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
118 > error=bar |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
119 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
120 > esac |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
121 > done |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
122 $ [ "${error}" = "long-unknown" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
123 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
124 Missing required option argument |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
125 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
126 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
127 > opt_a=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
128 > opt_b=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
129 > unset opt_b_val |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
130 > OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
131 > while getopts "ab:-:" opt --long-a --long-b arg ; do |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
132 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-b arg |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
133 > case "$opt" in |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
134 > a|long-a) opt_a=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
135 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
136 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
137 > b|long-b) opt_b=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
138 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
139 > opt_b_val="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
140 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
141 > ?) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
142 > error=foo |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
143 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
144 > *) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
145 > error=bar |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
146 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
147 > esac |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
148 > done |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
149 /bin/sh: ERROR: option argument required for option --long-b |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
150 $ [ "${error}" = "foo" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
151 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
152 Missing required option argument (alternate error handling) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
153 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
154 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
155 > opt_a=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
156 > opt_b=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
157 > unset opt_b_val |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
158 > OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
159 > while getopts ":ab:-:" opt --long-a --long-b arg ; do |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
160 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b=" "" --long-b arg |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
161 > case "$opt" in |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
162 > a|long-a) opt_a=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
163 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
164 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
165 > b|long-b) opt_b=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
166 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
167 > opt_b_val="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
168 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
169 > :) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
170 > error="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
171 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
172 > *) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
173 > error=bar |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
174 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
175 > esac |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
176 > done |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
177 $ [ "${error}" = "long-b" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
178 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
179 Option argument value not allowed |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
180 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
181 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
182 > opt_a=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
183 > opt_b=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
184 > unset opt_b_val |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
185 > OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
186 > while getopts "ab:-:" opt --long-a=a-value arg ; do |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
187 > postprocess_getopts_for_long "ab:-:" opt "long-a" "long-b=" "" --long-a=a-value arg |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
188 > case "$opt" in |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
189 > a|long-a) opt_a=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
190 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
191 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
192 > b|long-b) opt_b=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
193 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
194 > opt_b_val="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
195 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
196 > ?) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
197 > error=foo |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
198 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
199 > *) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
200 > error=bar |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
201 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
202 > esac |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
203 > done |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
204 /bin/sh: ERROR: no option argument allowed for option --long-a |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
205 $ [ "${error}" = "foo" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
206 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
207 Missing required option argument (alternate error handling) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
208 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
209 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
210 > opt_a=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
211 > opt_b=no |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
212 > unset opt_b_val |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
213 > OPTIND=1 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
214 > while getopts ":ab:-:" opt --long-a=a-value arg ; do |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
215 > postprocess_getopts_for_long ":ab:-:" opt "long-a" "long-b=" "" --long-a=a-value arg |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
216 > case "$opt" in |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
217 > a|long-a) opt_a=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
218 > [ -z "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
219 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
220 > b|long-b) opt_b=yes |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
221 > [ -n "${OPTARG+SET}" ] || echo "ERROR: OPTARG" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
222 > opt_b_val="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
223 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
224 > :) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
225 > error="${OPTARG}" |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
226 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
227 > *) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
228 > error=bar |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
229 > ;; |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
230 > esac |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
231 > done |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
232 $ [ "${error}" = "long-a" ] |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
233 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
234 Invalid character in long option |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
235 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
236 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
237 > OPTIND=1 |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
238 > getopts "ab:-:" opt --long=a |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
239 > postprocess_getopts_for_long "ab:-:" opt "long=a" "" --long=a arg |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
240 /bin/sh: ERROR: Long option specification contains a forbidden `=' character: long=a |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
241 [64] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
242 $ [ -z "${opt}" ] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
243 $ [ -z "${OPTARG+SET}" ] |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
244 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
245 Invalid character in long option (alternate error handling) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
246 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
247 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
248 > OPTIND=1 |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
249 > getopts ":a-:" opt --long=a |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
250 > postprocess_getopts_for_long ":a-:" opt "long=a" "" --long=a arg |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
251 /bin/sh: ERROR: Long option specification contains a forbidden `=' character: long=a |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
252 [64] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
253 $ [ -z "${opt}" ] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
254 $ [ -z "${OPTARG+SET}" ] |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
255 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
256 Invalid character in long option |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
257 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
258 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
259 > OPTIND=1 |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
260 > getopts "b:-:" opt --long=a |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
261 > postprocess_getopts_for_long "b:-:" opt "long=b=" "" --long=b=value arg |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
262 /bin/sh: ERROR: Long option specification contains a forbidden `=' character: long=b= |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
263 [64] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
264 $ [ -z "${opt}" ] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
265 $ [ -z "${OPTARG+SET}" ] |
|
803
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
266 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
267 Invalid character in long option (alternate error handling) |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
268 |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
269 $ error='' |
|
2cd233b137ec
common.subr: Implement postprocess_getopts_for_long() to process long options in combination with the Shell's internal getopts()
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
270 > OPTIND=1 |
|
809
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
271 > getopts ":b:-:" opt --long=a |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
272 > postprocess_getopts_for_long ":b:-:" opt "long=b=" "" --long=b=value arg |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
273 /bin/sh: ERROR: Long option specification contains a forbidden `=' character: long=b= |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
274 [64] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
275 $ [ -z "${opt}" ] |
|
6cf3e1021862
common.subr: Change handling of internal errors.
Franz Glasner <fzglas.hg@dom66.de>
parents:
803
diff
changeset
|
276 $ [ -z "${OPTARG+SET}" ] |
