comparison scripts/getan-report @ 535:d5acadeef0f8

improve usage message & simply code * Shorten help output for `--database` as the good option name is enough to explain. * Fix typo in help output for `--empty' * Simplyied code by removing `dest` and `metavar` for add_argument where it was not necessary because it was already the default if those parameters are not given. * Add Intevation and Magnus as rights holder and author for 2019 and 2020.
author Bernhard Reiter <bernhard@intevation.de>
date Wed, 08 Jan 2020 09:22:23 +0100
parents 31282f97b807
children 28b1c18c900f
comparison
equal deleted inserted replaced
534:5d4006e3210c 535:d5acadeef0f8
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 # 3 #
4 # (c) 2013, 2014 by Björn Ricks <bjoern.ricks@intevation.de> 4 # (c) 2013, 2014 by Björn Ricks <bjoern.ricks@intevation.de>
5 # 2019, 2020 Intevation GmbH
6 # Author(s):
7 # * Björn Ricks
8 # * Magnus Schieder
5 # 9 #
6 # This is Free Software licensed under the terms of GPLv3 or later. 10 # This is Free Software licensed under the terms of GPLv3 or later.
7 # For details see LICENSE coming with the source of 'getan'. 11 # For details see LICENSE coming with the source of 'getan'.
8 12
9 import codecs 13 import codecs
20 def main(): 24 def main():
21 usage='getan-report [options]' 25 usage='getan-report [options]'
22 parser = argparse.ArgumentParser(prog='getan', usage=usage, 26 parser = argparse.ArgumentParser(prog='getan', usage=usage,
23 description="You can find more information at https://pypi.org/project/getan/") 27 description="You can find more information at https://pypi.org/project/getan/")
24 28
25 parser.add_argument('-d', '--database', dest='database',metavar="DATABASE_FILE", 29 parser.add_argument('-d', '--database', metavar="DATABASE_FILE",
26 help='databasefile (default: ~/.getan/%(default)s)]', 30 help='(default: ~/.getan/%(default)s)]',
27 default=DEFAULT_DATABASE) 31 default=DEFAULT_DATABASE)
28 parser.add_argument('-t', '--template', dest='template', 32 parser.add_argument('-t', '--template',
29 metavar='TEMPLATE',
30 help="""name of getan template (wochenbericht, 33 help="""name of getan template (wochenbericht,
31 zeiterfassung, zeiterfassung2), 34 zeiterfassung, zeiterfassung2),
32 external templates must be stored in 35 external templates must be stored in
33 ~/.getan/templates/ to be able to call them.""") 36 ~/.getan/templates/ to be able to call them.""")
34 parser.add_argument('-u', '--user', dest='user', help='name of user') 37 parser.add_argument('-u', '--user', help='name of user')
35 parser.add_argument('-p', '--project', dest='project', 38 parser.add_argument('-p', '--project', help='key of output project')
36 help='key of output project') 39 parser.add_argument('-w', '--week', type=int, help='week of year')
37 parser.add_argument('-w', '--week', type=int, dest='week', 40 parser.add_argument('-y', '--year', type=int, help='year')
38 help='week of year') 41 parser.add_argument('-c', '--lastweek', help='entries of last working week',
39 parser.add_argument('-y', '--year', type=int, dest='year', help='year')
40 parser.add_argument('-c', '--lastweek', dest='lastweek',
41 help='entries of last working week',
42 action='store_true') 42 action='store_true')
43 parser.add_argument('-m', '--empty', dest='empty', 43 parser.add_argument('-m', '--empty',
44 help='show projects without an entries', 44 help='show projects without an entry',
45 action="store_true") 45 action="store_true")
46 parser.add_argument('--encoding', dest='encoding', 46 parser.add_argument('--encoding', help='encoding of output')
47 help='encoding of output', metavar='ENCODING')
48 47
49 args = parser.parse_args() 48 args = parser.parse_args()
50 49
51 if args.lastweek: 50 if args.lastweek:
52 week = (datetime.now() - timedelta(7)).isocalendar()[1] 51 week = (datetime.now() - timedelta(7)).isocalendar()[1]
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)