source: stamper/bin/stamps@ 54:4a88af83eca6

Last change on this file since 54:4a88af83eca6 was 41:dfe43abd388a, checked in by Borja Lopez <borja@…>, 10 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

  • Property exe set to *
File size: 860 bytes
Line 
1#!/usr/bin/env python
2
3from stamper.cli import build_args_parser
4from stamper import Stamper
5
6
7if __name__ == '__main__':
8
9 parser = build_args_parser()
10 args = parser.parse_args()
11
12 s = Stamper()
13 s.load_stamps()
14
15 # Set proper arguments if they have passed a date-based filter without
16 # a customer
17 if args.customer not in s.customers and not args.filter:
18 args.filter = args.customer
19 args.customer = None
20
21 # Call the proper methods, based on the given parameters
22 if args.timeline:
23 s.timeline(args.customer, args.filter)
24 elif args.delete:
25 s.remove_stamps(args.delete)
26 elif args.graph:
27 s.graph_stamps(args.customer, args.filter)
28 elif args.import_file:
29 s.import_stamps(args.import_file)
30 else:
31 s.show_stamps(args.customer, args.filter, args.verbose, args.sum)
Note: See TracBrowser for help on using the repository browser.