Blame view
tests/arg-parser.t
1019 Bytes
|
cffa56ed7
|
1 |
Helper alias. |
|
7a2ca5936
|
2 3 |
$ alias parse='-antigen-parse-args "url?, loc?;
> btype:?, no-local-clone?"'
|
|
cffa56ed7
|
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 43 44 45 46 47 48 |
No arguments (since all are specified as optional).
$ parse
(glob)
One positional argument.
$ parse name
local url='name'
Two arguments.
$ parse url location
local url='url'
local loc='location'
Three arguments.
$ parse url location crap
Only 2 positional arguments allowed.
Found at least one more: 'crap'
Keywordo magic.
$ parse url location --btype=1 --no-local-clone
local url='url'
local loc='location'
local btype='1'
local no_local_clone='true'
Unknown keyword argument.
$ parse --me=genius
Unknown argument 'me'.
Missed value for keyword argument.
$ parse --btype
Required argument for 'btype' not provided.
Provide value for keyword argument, that shouldn't be there.
$ parse --no-local-clone=yes
No argument required for 'no-local-clone', but provided 'yes'.
|
|
973558eee
|
49 50 51 52 53 |
Positional argument as a keyword argument.
$ parse --url=some-url
local url='some-url'
|