diff scripts/zeiterfassung.py @ 392:617ced8c7a40

scripts/zeiterfassung.py: enabled choice of used templates.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 16 Feb 2015 10:21:22 +0100
parents b8cd8751cba0
children
line wrap: on
line diff
--- a/scripts/zeiterfassung.py	Mon Feb 09 10:17:25 2015 +0100
+++ b/scripts/zeiterfassung.py	Mon Feb 16 10:21:22 2015 +0100
@@ -26,20 +26,22 @@
 
 USAGE = '''usage: %s <options>
     with <options>
-    [--user=|-u <user>]        : Name of user,          default: $USER
-    [--database=|-d <database>]: getan database,        default: time.db
-    [--project=|-p <key>]      : Key of output project, default: all
-    [--encoding=|-e encoding]  : encoding of output,    default: none
+    [--user=|-u <user>]        : Name of user,           default: $USER
+    [--database=|-d <database>]: getan database,         default: time.db
+    [--project=|-p <key>]      : Key of output project,  default: all
+    [--encoding=|-e encoding]  : encoding of output,     default: none
     [--week=]|-w <week>]       : week of year
     [--year=]|-y <year>]       : year
     [--list|-l]                : list all projects
     [--help|-h]                : This text
     [--emtpy|-m]               : show empty projects
-    [--lastweek|-c]            : entries of last working week'''
+    [--lastweek|-c]            : entries of last working week
+    [--template|-t <template>] : jinja2 template to use, default: zeiterfassung
+'''
 
 
 def usage(exit_code=0):
-    print USAGE % sys.argv[0]
+    print USAGE % sys.argv[0],
     sys.exit(exit_code)
 
 
@@ -58,9 +60,9 @@
 
     opts, args = getopt.getopt(
         sys.argv[1:],
-        'd:u:p:e:hl:w:y:mc',
+        'd:u:p:e:hl:w:y:mct:',
         ['database=', 'user=', 'project=', 'encoding=', 'help', 'list', 'week=',
-            'year=', 'empty', 'lastweek'])
+            'year=', 'empty', 'lastweek', 'template='])
 
     for opt, val in opts:
         if opt in ("--database", "-d"):
@@ -83,6 +85,8 @@
             week = (datetime.now() - timedelta(7)).isocalendar()[1]
         elif opt in ("--empty", "-m"):
             empty_proj = True
+        elif opt in ("--template", "-t"):
+            template = val
 
     if not encoding:
         encoding = locale.getdefaultlocale()[1]
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)