]> pilppa.org Git - uci.git/commitdiff
make use of the history path feature in the cli
authorFelix Fietkau <nbd@openwrt.org>
Sun, 3 Feb 2008 03:37:44 +0000 (04:37 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 3 Feb 2008 03:37:44 +0000 (04:37 +0100)
cli.c

diff --git a/cli.c b/cli.c
index 845fc2acee988e0ac285ba6d6e8f900d53549cf3..45a105a715320de7a2052a4a098b6532890887a9 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -53,6 +53,8 @@ static void uci_usage(int argc, char **argv)
                "\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"
+               "\t-p <path>  add a search path for config change files\n"
+               "\t-P <path>  add a search path for config change files and use as default\n"
                "\t-q         quiet mode (don't print error messages)\n"
                "\t-s         force strict mode (stop on parser errors, default)\n"
                "\t-S         disable strict mode\n"
@@ -316,7 +318,7 @@ int main(int argc, char **argv)
                return 1;
        }
 
-       while((c = getopt(argc, argv, "mf:sSnNq")) != -1) {
+       while((c = getopt(argc, argv, "f:mnNp:P:sSq")) != -1) {
                switch(c) {
                        case 'f':
                                input = fopen(optarg, "r");
@@ -341,6 +343,13 @@ int main(int argc, char **argv)
                        case 'N':
                                ctx->flags &= ~UCI_FLAG_EXPORT_NAME;
                                break;
+                       case 'p':
+                               uci_add_history_path(ctx, optarg);
+                               break;
+                       case 'P':
+                               uci_add_history_path(ctx, ctx->savedir);
+                               uci_set_savedir(ctx, optarg);
+                               break;
                        case 'q':
                                flags |= CLI_FLAG_QUIET;
                                break;