diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arguments.py | 13 | ||||
-rw-r--r-- | src/db/init.py | 2 | ||||
-rw-r--r-- | src/main.py | 4 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/arguments.py b/src/arguments.py new file mode 100644 index 0000000..0065b78 --- /dev/null +++ b/src/arguments.py @@ -0,0 +1,13 @@ +import argparse + +def parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + usage = '%(prog)s [OPTION]', + description = 'Manage a context-base next-action list.' + ) + parser.add_argument( + '-v', '--version', action = 'version', + version = f"{parser.prog} version 1.0.0" + ) + parser.add_argument('-d', '--database') + return parser diff --git a/src/db/init.py b/src/db/init.py index 83e73f2..8fb7098 100644 --- a/src/db/init.py +++ b/src/db/init.py @@ -4,7 +4,7 @@ import time def init(path): is_db_new = not os.path.isfile(path) - database = sqlite3.connect('database') + database = sqlite3.connect(path) if is_db_new: database.cursor().execute( " CREATE TABLE IF NOT EXISTS tasks(" diff --git a/src/main.py b/src/main.py index 293ec8d..e791196 100644 --- a/src/main.py +++ b/src/main.py @@ -5,8 +5,10 @@ import os.path import db.init import gui.window +import arguments -database = db.init.init('database') +args = arguments.parser().parse_args() +database = db.init.init(args.database if args.database != None else 'database') app = QtWidgets.QApplication(sys.argv) # # Allows to catch Ctrl-C event |