| 
            Last change
 on this file since 64:7a05243e2fc0 was             61:8fe64b5932b9, checked in by Borja Lopez <borja@…>, 11 years ago           | 
        
        
          | 
             
Filter stamps by text in their description/action. 
 
Examples: 
 
- Returns all stamps for customer A that contain the word "updated":
 
 
stamps -t -desc updated A 
 
 
 
- Returns the sum of times for the work on the release of a project
for customer B (if you added RELEASE as a text on those stamps):
 
 
stamps -vs -desc RELEASE B 
 
 
 
           | 
        
        
          | 
            
           | 
        
        
          | 
            File size:
            1.0 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | #!/usr/bin/env python
 | 
|---|
| 2 | 
 | 
|---|
| 3 | from stamper.cli import build_args_parser
 | 
|---|
| 4 | from stamper import Stamper
 | 
|---|
| 5 | 
 | 
|---|
| 6 | 
 | 
|---|
| 7 | if __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, args.description)
 | 
|---|
| 24 |     elif args.delete:
 | 
|---|
| 25 |         s.remove_stamps(args.delete)
 | 
|---|
| 26 |     elif args.graph:
 | 
|---|
| 27 |         s.graph_stamps(args.customer, args.filter, args.description)
 | 
|---|
| 28 |     elif args.import_file:
 | 
|---|
| 29 |         s.import_stamps(args.import_file)
 | 
|---|
| 30 |     elif args.push:
 | 
|---|
| 31 |         s.push_stamps(args.customer, args.filter, args.description)
 | 
|---|
| 32 |     else:
 | 
|---|
| 33 |         s.show_stamps(args.customer, args.filter, args.verbose, args.sum,
 | 
|---|
| 34 |                       args.description)
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.