Create the command line argument -v/--version to print version

https://forums.ankiweb.net/t/i-couldnt-open-anki-resetting-corrupt-global/190
This commit is contained in:
evandrocoan 2020-06-19 13:11:04 -03:00
parent b51f03085e
commit 9867e5e1f7

View file

@ -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