Last change
on this file since 20:08ff1a4438c5 was 10:d3a34cb9b65f, checked in by Borja Lopez <borja@…>, 10 years ago |
Use argparse to parse the arguments to the stamps script.
Moved all the logic to display stamps information to the main
stamper module.
|
|
File size:
713 bytes
|
Rev | Line | |
---|
[0] | 1 | #!/usr/bin/env python
|
---|
| 2 |
|
---|
[10] | 3 | import argparse
|
---|
[0] | 4 | from stamper import Stamper
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | if __name__ == '__main__':
|
---|
| 8 |
|
---|
[10] | 9 | parser = argparse.ArgumentParser(
|
---|
| 10 | description='stamps: show recorded times information')
|
---|
| 11 | parser.add_argument('customer', action="store", nargs='?',
|
---|
| 12 | help='Show times only for this customer')
|
---|
| 13 | parser.add_argument('filter', action="store", nargs='?',
|
---|
| 14 | help='Filter the times by date range')
|
---|
| 15 | parser.add_argument('-v', '--verbose', action="store_true",
|
---|
| 16 | help='Include detailed times information')
|
---|
| 17 |
|
---|
| 18 | args = parser.parse_args()
|
---|
| 19 |
|
---|
[0] | 20 | s = Stamper()
|
---|
| 21 | s.load_stamps()
|
---|
[10] | 22 | s.show_stamps(args.customer, args.filter, args.verbose)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.