source: stamper/stamper/cli.py@ 41:dfe43abd388a

Last change on this file since 41:dfe43abd388a was 41:dfe43abd388a, checked in by Borja Lopez <borja@…>, 6 years ago

Moved the argparser parser generation to a function inside the stamper
module. Then using that function in the stamps tool to generate the
parser.

This allows us to use sphinx-argparse [1] for documentation, and will
help a bit with testing, once we add tests.

[1] http://sphinx-argparse.readthedocs.org/en/latest/index.html

File size: 1.2 KB
Line 
1import argparse
2
3
4def build_args_parser():
5 parser = argparse.ArgumentParser(
6 description='stamps: show recorded times information')
7 parser.add_argument('customer', action="store", nargs='?',
8 help='Show times only for this customer')
9 parser.add_argument('filter', action="store", nargs='?',
10 help='Filter the times by date range')
11 parser.add_argument('-v', '--verbose', action="store_true",
12 help='Include detailed times information')
13 parser.add_argument('-s', '--sum', action="store_true",
14 help='Include sum of times')
15 parser.add_argument('-g', '--graph', action="store_true",
16 help='Generate a SVG graph')
17 parser.add_argument('-t', '--timeline', action="store_true",
18 help='Show a timeline of recorded times')
19 parser.add_argument('-d', '--delete', action="store", type=int,
20 help='Delete up to n recorded stamps')
21 parser.add_argument('-i', '--import', action="store", dest="import_file",
22 help='Import stamps from the given file')
23 return parser
Note: See TracBrowser for help on using the repository browser.