Mercurial > getan > getan
comparison getan/main.py @ 551:d44ee9cd7261
Overworked standard database transfer parameter
author | Magnus Schieder <mschieder@intevation.de> |
---|---|
date | Wed, 12 Feb 2020 13:10:44 +0100 |
parents | 525ac205dca2 |
children | a59e318c3f72 |
comparison
equal
deleted
inserted
replaced
550:28b1c18c900f | 551:d44ee9cd7261 |
---|---|
50 description="You can find more information at https://pypi.org/project/getan/", | 50 description="You can find more information at https://pypi.org/project/getan/", |
51 formatter_class=argparse.RawTextHelpFormatter) | 51 formatter_class=argparse.RawTextHelpFormatter) |
52 parser.add_argument('--version', action='version', | 52 parser.add_argument('--version', action='version', |
53 version=textwrap.dedent(version)) | 53 version=textwrap.dedent(version)) |
54 parser.add_argument(dest='filename', nargs='?', | 54 parser.add_argument(dest='filename', nargs='?', |
55 help='[databasefile (default: ~/.getan/%(default)s)]', | 55 help='databasefile (default: ~/.getan/' + DEFAULT_DATABASE + ')') |
56 default=DEFAULT_DATABASE) | |
57 parser.add_argument('--init-only', action='store_true', dest='initonly', | 56 parser.add_argument('--init-only', action='store_true', dest='initonly', |
58 help='create databasefile if necessary and exit') | 57 help='create databasefile if necessary and exit') |
59 parser.add_argument('-d', '--debug', action='store_const', dest='loglevel', | 58 parser.add_argument('-d', '--debug', action='store_const', dest='loglevel', |
60 default=logging.NOTSET, const=logging.DEBUG, | 59 default=logging.NOTSET, const=logging.DEBUG, |
61 help='Enable debung mode') | 60 help='Enable debung mode') |
66 args = parser.parse_args() | 65 args = parser.parse_args() |
67 | 66 |
68 config.initialize(args.loglevel, args.logfile) | 67 config.initialize(args.loglevel, args.logfile) |
69 global logger | 68 global logger |
70 | 69 |
71 if args.filename != DEFAULT_DATABASE: | 70 if args.filename: |
72 database = args.filename | 71 database = args.filename |
73 else: | 72 else: |
74 if os.path.isfile(DEFAULT_DATABASE): | 73 if os.path.isfile(DEFAULT_DATABASE): |
75 database = os.path.abspath(DEFAULT_DATABASE) | 74 database = os.path.abspath(DEFAULT_DATABASE) |
76 else: | 75 else: |