[cli] Add version and release codename to help

This commit is contained in:
derrod 2020-04-28 06:14:17 +02:00
parent 0d08263afa
commit 2be1d367df
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,4 @@
"""Legendary!"""
__version__ = '0.0.4'
__codename__ = 'Unforeseen Consequences'

View file

@ -13,6 +13,7 @@ from logging.handlers import QueueHandler, QueueListener
from multiprocessing import freeze_support, Queue as MPQueue
from sys import exit
from legendary import __version__, __codename__
from legendary.core import LegendaryCore
from legendary.models.exceptions import InvalidCredentialsError
@ -320,11 +321,12 @@ class LegendaryCLI:
def main():
parser = argparse.ArgumentParser(description='Legendary Game Launcher')
parser = argparse.ArgumentParser(description=f'Legendary v{__version__} - "{__codename__}"')
# general arguments
parser.add_argument('-v', dest='debug', action='store_true', help='Set loglevel to debug')
parser.add_argument('-y', dest='yes', action='store_true', help='Default to yes for all prompts')
parser.add_argument('-V', dest='version', action='store_true', help='Print version and exit')
# all the commands
subparsers = parser.add_subparsers(title='Commands', dest='subparser_name')
@ -385,6 +387,10 @@ def main():
args, extra = parser.parse_known_args()
if args.version:
print(f'legendary version "{__version__}", codename "{__codename__}"')
exit(0)
if args.subparser_name not in ('auth', 'list-games', 'list-installed', 'launch', 'download', 'uninstall'):
print(parser.format_help())