File: arguments_with_help.py

package info (click to toggle)
python-cloup 3.0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 936 kB
  • sloc: python: 5,371; makefile: 120
file content (43 lines) | stat: -rw-r--r-- 979 bytes parent folder | download | duplicates (3)
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
"""
Show-casing the "Positional arguments" help section.
"""
from pprint import pprint

import cloup
from cloup import option, option_group


@cloup.command(name='cloup', show_constraints=True)
@cloup.argument('input_path', help="Input path")
@cloup.argument('out_path', help="Output path")
@option_group(
    'An option group',
    option('-o', '--one', help='a 1st cool option'),
    option('-t', '--two', help='a 2nd cool option'),
    option('--three', help='a 3rd cool option'),
)
def main(**kwargs):
    """A test program for cloup."""
    pprint(kwargs, indent=3)


if __name__ == '__main__':
    main()

"""
Usage: arguments_with_help.py [OPTIONS] INPUT_PATH OUT_PATH

  A test program for cloup.

Positional arguments:
  INPUT_PATH      Input path
  OUT_PATH        Output path

An option group:
  -o, --one TEXT  a 1st cool option
  -t, --two TEXT  a 2nd cool option
  --three TEXT    a 3rd cool option

Other options:
  --help          Show this message and exit.
"""