Changeset 41:dfe43abd388a in stamper for bin


Ignore:
Timestamp:
Aug 14, 2014, 12:18:26 AM (10 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/stamps

    r40 r41  
    11#!/usr/bin/env python
    22
    3 import argparse
     3from stamper.cli import build_args_parser
    44from stamper import Stamper
    55
     
    77if __name__ == '__main__':
    88
    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     parser.add_argument('-s', '--sum', action="store_true",
    18                         help='Include sum of times')
    19     parser.add_argument('-g', '--graph', action="store_true",
    20                         help='Generate a SVG graph')
    21     parser.add_argument('-t', '--timeline', action="store_true",
    22                         help='Show a timeline of recorded times')
    23     parser.add_argument('-d', '--delete', action="store", type=int,
    24                         help='Delete up to n recorded stamps')
    25     parser.add_argument('-i', '--import', action="store", dest="import_file",
    26                         help='Import stamps from the given file')
    27 
     9    parser = build_args_parser()
    2810    args = parser.parse_args()
    2911
Note: See TracChangeset for help on using the changeset viewer.