[Getan-commits] [PATCH] scripts/zeiterfassung.py: enabled choice of used templates

Wald Commits scm-commit at wald.intevation.org
Mon Feb 16 10:21:54 CET 2015


# HG changeset patch
# User Bernhard Reiter <bernhard at intevation.de>
# Date 1424078482 -3600
# Node ID 617ced8c7a40e29e6ec7734cf6ba2d109524e86f
# Parent  58537062fe7429dae5875591173a034ab1199d2e
scripts/zeiterfassung.py: enabled choice of used templates.

diff -r 58537062fe74 -r 617ced8c7a40 scripts/zeiterfassung.py
--- 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]


More information about the Getan-commits mailing list