File: test_argparse.py

package info (click to toggle)
imediff 3.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 820 kB
  • sloc: python: 6,397; sh: 904; xml: 336; makefile: 28
file content (33 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/python3
# vim:se tw=79 sts=4 ts=4 et ai fileencoding=utf-8 :

import argparse

# This allows different reporting style for TUI/CLI
pa = argparse.ArgumentParser(
    description="SIMPLE example",
    epilog="See README.md for more",
)
group = pa.add_mutually_exclusive_group()
group.add_argument(
    "-a", action="store_true", help="Start with all chunks to use file_a"
)
group.add_argument(
    "-b", action="store_true", help="Start with all chunks to use file_b"
)
group.add_argument(
    "-c",
    action="store_true",
    help="Start with all chunks to use file_c (only for diff3)",
)
pa.add_argument(
    "--rule-filter",
    "-r",
    action="store",
    default=2,
    help="Fuzzy match line filtering rule (0,1,2,3,10,11,12,13)",
)
args = pa.parse_args()

print("a={}, b={}, c={}".format(args.a, args.b, args.c))
print("rule-filter={}".format(args.rule_filter))