OILS / spec / ysh-stdlib-args.test.sh View on Github | oilshell.org

37 lines, 18 significant
1## our_shell: ysh
2## oils_failures_allowed: 1
3
4#### Basic help message
5
6source $LIB_YSH/args.ysh
7
8parser (&spec) {
9 # TODO: implement description, prog and help message
10 description '''
11 Reference Implementation
12 '''
13 prog "program-name"
14
15 arg -v --verbose (Bool, help = "Verbose")
16 arg src
17 arg dst
18}
19var argv = ['-h', 'src', 'dst']
20
21# Help
22var args = parseArgs(spec, argv)
23
24## STDOUT:
25usage: program-name [-h] [-v] src dst
26
27Reference Implementation
28
29positional arguments:
30 src
31 dst
32
33options:
34 -h, --help show this help message and exit
35 -v, --verbose Verbose
36## END
37