Blame view
repos/zsh-users/antigen/tests/arg-parser.t
1.23 KB
|
ddbb98497
|
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
Helper alias.
$ alias parse='-antigen-parse-args "url?, loc?;
> btype:?, no-local-clone?"'
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'.
Positional argument as a keyword argument.
$ parse --url=some-url
local url='some-url'
Repeated keyword arguments.
$ parse --url=url1 --url=url2
Argument 'url' repeated with the value 'url2'.
Repeated, once as positional and once more as keyword.
$ parse url1 --url=url2
Argument 'url' repeated with the value 'url2'.
|