1
0
mirror of https://github.com/gryf/boxpy.git synced 2025-12-18 21:10:17 +01:00

Added boxpy --version option.

This commit is contained in:
2021-08-13 11:43:33 +02:00
parent b2a6305728
commit bd59dd378e

8
box.py
View File

@@ -16,6 +16,8 @@ import xml.dom.minidom
import yaml
__version__ = "1.0"
CACHE_DIR = os.environ.get('XDG_CACHE_HOME', os.path.expanduser('~/.cache'))
CLOUD_IMAGE = "ci.iso"
FEDORA_RELEASE_MAP = {'32': '1.6', '33': '1.2', '34': '1.2'}
@@ -1303,6 +1305,8 @@ def main():
group.add_argument('-q', '--quiet', action='count', default=0,
help='suppress output. Adding more "q" will make '
'boxpy to shut up.')
parser.add_argument('-V', '--version', action='store_true',
help="show boxpy version and exit")
subparsers = parser.add_subparsers(help='supported commands')
@@ -1394,6 +1398,10 @@ def main():
LOG.set_verbose(args.verbose, args.quiet)
if args.version:
LOG.info(f'boxpy {__version__}')
parser.exit()
if hasattr(args, 'func'):
return args.func(args)