from core.config import config_set, config_get __all__ = [ '__VXSDK_MODULE_META__', 'cli_validate', 'cli_parse', ] __VXSDK_MODULE_META__ = ( ['config'], "vxSDK configuration module", r"""vxsdk-configuration VxSDK configuration and options USAGE: vxsdk config [] DESCRIPTION: Change / customise the vxSDK behaviour """ ) # TODO: list all key available # TODO: level selection : 'local', 'global' def cli_validate(name): return name in __VXSDK_MODULE_META__[0] def cli_parse(argv): """ Config subcommand entry """ if '--help' in argv or '-h' in argv: logger(LOG_USER, __VXSDK_MODULE_META__[2]) return 0 if len(argv) == 2: logger(LOG_USER, config_get(argv[1])) return 0 if len(argv) == 3: if old := config_set(argv[1], argv[2]): logger(LOG_USER, f"previous value = {old}") return 0 logger(LOG_EMERG, __VXSDK_MODULE_META__[2]) return 84