62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
"""vxsdk-converter modules
|
|
|
|
This package provides conversion abstraction (image -> source code, ELF ->
|
|
addin, ...) for the Vhex project.
|
|
"""
|
|
|
|
from core.logger import log
|
|
|
|
from cli.conv.doctor import conv_doctor_cli_parse
|
|
from cli.conv.asset import conv_asset_cli_parse
|
|
from cli.conv.addin import conv_addin_cli_parse
|
|
|
|
|
|
__all__ = [
|
|
'__VXSDK_MODULE_META__',
|
|
'cli_validate',
|
|
'cli_parse',
|
|
]
|
|
|
|
__VXSDK_MODULE_META__ = (
|
|
['conv'],
|
|
'assets converter',
|
|
r"""vxsdk-conv
|
|
Project assets conv
|
|
|
|
USAGE:
|
|
vxsdk conv(-<ACTION>) [OPTIONS] ...
|
|
|
|
DESCRIPTION:
|
|
Convert vhex project assets (or binary) into various form. By default, if no
|
|
action is specified, the "asset" conversion is selected.
|
|
|
|
ACTIONS:
|
|
doctor try to display assets and addin information (debug)
|
|
asset convert asset into source file or binary file
|
|
addin convert binary into addin file for vxOS
|
|
|
|
See `vxsdk conv <action> --help` for more information on a specific action
|
|
"""
|
|
)
|
|
|
|
def cli_validate(name):
|
|
""" validate the module name """
|
|
return name.find('conv') == 0
|
|
|
|
def cli_parse(argv):
|
|
""" Build subcommand entry """
|
|
if '--help' in argv or '-h' in argv:
|
|
log.user(__VXSDK_MODULE_META__[2])
|
|
return 0
|
|
if argv[0].find('conv-') != 0:
|
|
argv[0] = 'conv-asset'
|
|
action = argv[0][5:]
|
|
if action == 'doctor':
|
|
return conv_doctor_cli_parse(argv[1:])
|
|
if action == 'asset':
|
|
return conv_asset_cli_parse(argv[1:])
|
|
if action == 'addin':
|
|
return conv_addin_cli_parse(argv[1:])
|
|
log.error(f"unable to find action '{action}'")
|
|
return 84
|