mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[cli] Add version and release codename to help
This commit is contained in:
parent
0d08263afa
commit
2be1d367df
|
@ -1,3 +1,4 @@
|
||||||
"""Legendary!"""
|
"""Legendary!"""
|
||||||
|
|
||||||
__version__ = '0.0.4'
|
__version__ = '0.0.4'
|
||||||
|
__codename__ = 'Unforeseen Consequences'
|
||||||
|
|
|
@ -13,6 +13,7 @@ from logging.handlers import QueueHandler, QueueListener
|
||||||
from multiprocessing import freeze_support, Queue as MPQueue
|
from multiprocessing import freeze_support, Queue as MPQueue
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
|
||||||
|
from legendary import __version__, __codename__
|
||||||
from legendary.core import LegendaryCore
|
from legendary.core import LegendaryCore
|
||||||
from legendary.models.exceptions import InvalidCredentialsError
|
from legendary.models.exceptions import InvalidCredentialsError
|
||||||
|
|
||||||
|
@ -320,11 +321,12 @@ class LegendaryCLI:
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Legendary Game Launcher')
|
parser = argparse.ArgumentParser(description=f'Legendary v{__version__} - "{__codename__}"')
|
||||||
|
|
||||||
# general arguments
|
# general arguments
|
||||||
parser.add_argument('-v', dest='debug', action='store_true', help='Set loglevel to debug')
|
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('-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
|
# all the commands
|
||||||
subparsers = parser.add_subparsers(title='Commands', dest='subparser_name')
|
subparsers = parser.add_subparsers(title='Commands', dest='subparser_name')
|
||||||
|
@ -385,6 +387,10 @@ def main():
|
||||||
|
|
||||||
args, extra = parser.parse_known_args()
|
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'):
|
if args.subparser_name not in ('auth', 'list-games', 'list-installed', 'launch', 'download', 'uninstall'):
|
||||||
print(parser.format_help())
|
print(parser.format_help())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue