"\texport [<config>]\n"
"\timport [<config>]\n"
"\tchanges [<config>]\n"
+ "\tcommit [<config>]\n"
"\tadd <config> <section-type>\n"
"\tshow [<config>[.<section>[.<option>]]]\n"
"\tget <config>.<section>[.<option>]\n"
"\trevert <config>[.<section>[.<option>]]\n"
"\n"
"Options:\n"
+ "\t-c <path> set the search path for config files (default: /etc/config)\n"
"\t-f <file> use <file> as input instead of stdin\n"
"\t-m when importing, merge data into an existing package\n"
"\t-n name unnamed sections on export (default)\n"
struct uci_package *p = NULL;
int ret;
- if (cmd == CMD_CHANGES)
- ctx->flags |= UCI_FLAG_SAVED_HISTORY;
ret = uci_load(ctx, package, &p);
- if (cmd == CMD_CHANGES)
- ctx->flags &= ~UCI_FLAG_SAVED_HISTORY;
if (ret != UCI_OK) {
cli_perror();
fprintf(stderr, "Unknown command\n");
/* clean up */
- uci_cleanup(ctx);
uci_foreach_element_safe(&ctx->root, tmp, e) {
uci_unload(ctx, uci_to_package(e));
}
return 1;
}
- while((c = getopt(argc, argv, "f:mnNp:P:sSq")) != -1) {
+ while((c = getopt(argc, argv, "c:f:mnNp:P:sSq")) != -1) {
switch(c) {
+ case 'c':
+ uci_set_confdir(ctx, optarg);
+ break;
case 'f':
input = fopen(optarg, "r");
if (!input) {