@@ -19,20 +19,20 @@ args_set_description "example of description"
1919args_set_epilog " example of epilog"
2020
2121args_add_argument \
22- --name=" ARG1" \
23- --help=" take the first argument" \
24- --dest=" ARG1" \
25- --required=" true"
26- args_add_bool_option \
27- --short=" c" \
28- --long=" clear" \
22+ --help " take the first argument" \
23+ --dest " ARG1" \
24+ --required \
25+ -- " ARG1"
26+ args_add_argument \
2927 --help=" clear the test directory" \
30- --dest=" OPT_CLEAR"
31- args_add_option \
32- --long=" option" \
28+ --action=" store_true" \
29+ --dest=" OPT_CLEAR" \
30+ -- " -c" " --clear"
31+ args_add_argument \
3332 --help=" help of option" \
3433 --metavar=" VALUE" \
35- --default=" 24"
34+ --default=" 24" \
35+ -- " --option"
3636
3737args_parse_arguments " $@ "
3838
@@ -72,74 +72,32 @@ $ ./example/quickstart.sh 42
7272
7373### args_add_argument
7474
75- Add a positional argument
75+ Add a argument
7676
7777| option| description|
7878| ---| ---|
79+ | --action| Action (store,store_true,store_false) (default: store )|
7980| --default| Default value|
8081| --dest| Destination variable|
8182| --help| Usage helper|
82- | --name| Name of argument|
83- | --required| Is required if true|
84-
85- #### Example
86-
87- ``` bash
88- args_add_argument --name=" FOO" --help=" help of FOO" --dest=" FOO" --required=" true"
89- ```
90-
91- ### args_add_bool_option
92-
93- Add a boolean option
94-
95- | option| description|
96- | ---| ---|
97- | --dest| Destination variable|
98- | --help| Usage helper|
99- | --long| Long option name|
100- | --short| Short option name|
101-
102- #### Example
103-
104- ``` bash
105- args_add_bool_option --short=" f" --long=" foo" --help=" help of foo" --dest=" FOO"
106- ```
107-
108- ### args_add_reverse_bool_option
109-
110- Add a reverse boolean option
111-
112- | option| description|
113- | ---| ---|
114- | --dest| Destination variable|
115- | --help| Usage helper|
116- | --long| Long option name|
117- | --short| Short option name|
118-
119- #### Example
83+ | --metavar| Usage argument name (if not set use long/short name)|
84+ | --required| Is required if present|
12085
12186``` bash
122- args_add_reverse_bool_option --short= " f " --long= " foo " --help= " help of foo " --dest= " FOO "
87+ args_add_argument [options] -- [name/flags...]
12388```
12489
125- ### args_add_option
126-
127- Add a option who take a argument
128-
129- | option| description|
130- | ---| ---|
131- | --default| Default value of option|
132- | --dest| Destination variable|
133- | --help| Usage helper|
134- | --long| Long option name|
135- | --metavar| Usage argument name (if not set use long/short name)|
136- | --required| Is required if true|
137- | --short| Short option name|
138-
139- #### Example
90+ #### Examples
14091
14192``` bash
142- args_add_option --short=" f" --long=" foo" --help=" help of foo" --dest=" FOO"
93+ # positional argument
94+ args_add_argument --help=" help of FOO" --dest=" FOO" --required -- " FOO"
95+ # boolean optional argument
96+ args_add_argument --action=" store_true" --help=" help of foo" --dest=" FOO" -- " -f" " --foo"
97+ # not boolean optional argument
98+ args_add_argument --action=" store_false" --help=" help of foo" --dest=" FOO" -- " -f" " --foo"
99+ # optional argument
100+ args_add_argument --help=" help of foo" --dest=" FOO" -- " -f" " --foo"
143101```
144102
145103### args_parse_arguments
0 commit comments