|
@@ -27,8 +27,28 @@ def _prepare_fake_data(bigtool):
|
|
|
|
|
|
bigtool.add_module_info(zone_module)
|
|
|
bigtool.add_module_info(boss_module)
|
|
|
-
|
|
|
|
|
|
+def prepare_data_module(bigtool, module_name, module_commands):
|
|
|
+ module = ModuleInfo(name = module_name,
|
|
|
+ desc = "same here")
|
|
|
+ for command in module_commands:
|
|
|
+ cmd = CommandInfo(name = command["command_name"],
|
|
|
+ desc = "todo2",
|
|
|
+ need_inst_param = False)
|
|
|
+ for arg in command["command_args"]:
|
|
|
+ param = ParamInfo(name = arg["item_name"],
|
|
|
+ type = arg["item_type"],
|
|
|
+ optional = bool(arg["item_optional"]))
|
|
|
+ if ("item_default" in arg):
|
|
|
+ param.default = arg["item_default"]
|
|
|
+ cmd.add_param(param)
|
|
|
+ module.add_command(cmd)
|
|
|
+ bigtool.add_module_info(module)
|
|
|
+
|
|
|
+def prepare_data(bigtool, command_spec):
|
|
|
+ for module_name in command_spec.keys():
|
|
|
+ prepare_data_module(bigtool, module_name, command_spec[module_name])
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
try:
|
|
|
cc = ISC.CC.Session()
|
|
@@ -37,6 +57,9 @@ if __name__ == '__main__':
|
|
|
cc.group_subscribe("Boss", "*", "meonly")
|
|
|
|
|
|
tool = BigTool(cc)
|
|
|
+ cc.group_sendmsg({ "command": ["get_commands"] }, "ConfigManager")
|
|
|
+ command_spec, env = cc.group_recvmsg(False)
|
|
|
+ prepare_data(tool, command_spec["result"])
|
|
|
_prepare_fake_data(tool)
|
|
|
tool.cmdloop()
|
|
|
except ISC.CC.SessionError:
|