aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWolfgang Müller2021-05-05 17:31:37 +0200
committerWolfgang Müller2021-05-05 17:31:37 +0200
commit5765046fc529ea2c76fdafb676e31e96524bdd7c (patch)
treed077051d34bbe543f34363df4cd1933e1c9b2ec7
parent517458eeb9c7e1f3c41d8071978e48bc9822a1b2 (diff)
downloadquarg-5765046fc529ea2c76fdafb676e31e96524bdd7c.tar.gz
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.
-rw-r--r--quarg/main.py6
1 files changed, 3 insertions, 3 deletions
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)