From 9867e5e1f7f7a469a0f2b71679d167b55f520de5 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Fri, 19 Jun 2020 13:11:04 -0300 Subject: [PATCH] Create the command line argument -v/--version to print version https://forums.ankiweb.net/t/i-couldnt-open-anki-resetting-corrupt-global/190 --- qt/aqt/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qt/aqt/__init__.py b/qt/aqt/__init__.py index 4ad1fa2c2..48ceb839a 100644 --- a/qt/aqt/__init__.py +++ b/qt/aqt/__init__.py @@ -309,6 +309,7 @@ def parseArgs(argv): parser.add_argument("-b", "--base", help="path to base folder", default="") parser.add_argument("-p", "--profile", help="profile name to load", default="") parser.add_argument("-l", "--lang", help="interface language (en, de, etc)") + parser.add_argument("-v", "--version", help="print the Anki version and exit") return parser.parse_known_args(argv[1:]) @@ -412,6 +413,10 @@ def _run(argv=None, exec=True): # parse args opts, args = parseArgs(argv) + if opts.version: + print(f"Anki version '{appVersion}'") + return + if PROFILE_CODE: import cProfile