- if (!strcasecmp(argv[0], "show"))
- return uci_show(argc, argv);
- if (!strcasecmp(argv[0], "export"))
- return uci_do_export(argc, argv);
- if (!strcasecmp(argv[0], "get"))
- return uci_do_get(argc, argv);
- if (!strcasecmp(argv[0], "set"))
- return uci_do_set(argc, argv);
- return 255;
+ int cmd = 0;
+
+ if (!strcasecmp(argv[0], "batch") && !(flags & CLI_FLAG_BATCH))
+ return uci_batch();
+ else if (!strcasecmp(argv[0], "show"))
+ cmd = CMD_SHOW;
+ else if (!strcasecmp(argv[0], "changes"))
+ cmd = CMD_CHANGES;
+ else if (!strcasecmp(argv[0], "export"))
+ cmd = CMD_EXPORT;
+ else if (!strcasecmp(argv[0], "commit"))
+ cmd = CMD_COMMIT;
+ else if (!strcasecmp(argv[0], "get"))
+ cmd = CMD_GET;
+ else if (!strcasecmp(argv[0], "set"))
+ cmd = CMD_SET;
+ else if (!strcasecmp(argv[0], "ren") ||
+ !strcasecmp(argv[0], "rename"))
+ cmd = CMD_RENAME;
+ else if (!strcasecmp(argv[0], "revert"))
+ cmd = CMD_REVERT;
+ else if (!strcasecmp(argv[0], "del"))
+ cmd = CMD_DEL;
+ else if (!strcasecmp(argv[0], "import"))
+ cmd = CMD_IMPORT;
+ else if (!strcasecmp(argv[0], "help"))
+ cmd = CMD_HELP;
+ else if (!strcasecmp(argv[0], "add"))
+ cmd = CMD_ADD;
+ else
+ cmd = -1;
+
+ switch(cmd) {
+ case CMD_GET:
+ case CMD_SET:
+ case CMD_DEL:
+ case CMD_RENAME:
+ case CMD_REVERT:
+ return uci_do_section_cmd(cmd, argc, argv);
+ case CMD_SHOW:
+ case CMD_EXPORT:
+ case CMD_COMMIT:
+ case CMD_CHANGES:
+ return uci_do_package_cmd(cmd, argc, argv);
+ case CMD_IMPORT:
+ return uci_do_import(argc, argv);
+ case CMD_ADD:
+ return uci_do_add(argc, argv);
+ case CMD_HELP:
+ uci_usage();
+ return 0;
+ default:
+ return 255;
+ }