X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=cli.c;h=41179d70e2dae16865237436126591e946039fb3;hb=HEAD;hp=0b2a76d5698f9a6c00365e3bfe18456baac3baaa;hpb=defdac4bf39c2eca8d3def190c6eb6ca6bdf7723;p=uci.git diff --git a/cli.c b/cli.c index 0b2a76d..41179d7 100644 --- a/cli.c +++ b/cli.c @@ -27,6 +27,7 @@ static enum { CLI_FLAG_NOCOMMIT = (1 << 2), CLI_FLAG_BATCH = (1 << 3), CLI_FLAG_SHOW_EXT = (1 << 4), + CLI_FLAG_NOPLUGINS= (1 << 5), } flags; static FILE *input; @@ -138,6 +139,7 @@ static void uci_usage(void) "\t-c set the search path for config files (default: /etc/config)\n" "\t-d set the delimiter for list values in uci show\n" "\t-f use as input instead of stdin\n" + "\t-L do not load any plugins\n" "\t-m when importing, merge data into an existing package\n" "\t-n name unnamed sections on export (default)\n" "\t-N don't name unnamed sections\n" @@ -222,8 +224,8 @@ static void uci_show_changes(struct uci_package *p) { struct uci_element *e; - uci_foreach_element(&p->saved_history, e) { - struct uci_history *h = uci_to_history(e); + uci_foreach_element(&p->saved_delta, e) { + struct uci_delta *h = uci_to_delta(e); char *prefix = ""; char *op = "="; @@ -401,6 +403,7 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv) if (argc != 2) return 255; + printf("argv[1]: %s\n", argv[1]); if (uci_lookup_ptr(ctx, &ptr, argv[1], true) != UCI_OK) { cli_perror(); return 1; @@ -583,8 +586,9 @@ static int uci_cmd(int argc, char **argv) case CMD_DEL: case CMD_RENAME: case CMD_REVERT: - case CMD_REORDER: + case CMD_REORDER: { return uci_do_section_cmd(cmd, argc, argv); + } case CMD_SHOW: case CMD_EXPORT: case CMD_COMMIT: @@ -616,7 +620,7 @@ int main(int argc, char **argv) return 1; } - while((c = getopt(argc, argv, "c:d:f:mnNp:P:sSqX")) != -1) { + while((c = getopt(argc, argv, "c:d:f:LmnNp:P:sSqX")) != -1) { switch(c) { case 'c': uci_set_confdir(ctx, optarg); @@ -631,6 +635,9 @@ int main(int argc, char **argv) return 1; } break; + case 'L': + flags |= CLI_FLAG_NOPLUGINS; + break; case 'm': flags |= CLI_FLAG_MERGE; break; @@ -648,10 +655,10 @@ int main(int argc, char **argv) ctx->flags &= ~UCI_FLAG_EXPORT_NAME; break; case 'p': - uci_add_history_path(ctx, optarg); + uci_add_delta_path(ctx, optarg); break; case 'P': - uci_add_history_path(ctx, ctx->savedir); + uci_add_delta_path(ctx, ctx->savedir); uci_set_savedir(ctx, optarg); flags |= CLI_FLAG_NOCOMMIT; break; @@ -675,6 +682,10 @@ int main(int argc, char **argv) uci_usage(); return 0; } + + if (!(flags & CLI_FLAG_NOPLUGINS)) + uci_load_plugins(ctx, NULL); + ret = uci_cmd(argc - 1, argv + 1); if (input != stdin) fclose(input);