From 5765046fc529ea2c76fdafb676e31e96524bdd7c Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Wed, 5 May 2021 17:31:37 +0200 Subject: main: Make sure to parse arguments before reading config If quarg is unable to find the database URL, it immediately exits with an error message. This happens before parsing any arguments given on the command line, meaning that users cannot access the built-in help page if they have not yet created a config file. This commit makes sure that command line arguments are parsed before checking the config file so that --help can be used even without a config file. --- quarg/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'quarg/main.py') diff --git a/quarg/main.py b/quarg/main.py index 5e0aaf8..36e6f92 100644 --- a/quarg/main.py +++ b/quarg/main.py @@ -120,14 +120,14 @@ def time_query(query): return rows, end - start def main(): + args = cli.parse_args() + check_args(args) + config = get_config() if not config.has_option('Database', 'url'): errx('No database URL set in config file.') - args = cli.parse_args() - check_args(args) - engine = create_engine(config.get('Database', 'url'), echo=args.debug) session = Session(bind=engine) -- cgit v1.2.3-2-gb3c3