]> pilppa.com Git - uci.git/commitdiff
correctly show list changes in "uci changes" output
authorFelix Fietkau <nbd@openwrt.org>
Tue, 19 Aug 2008 20:28:07 +0000 (22:28 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 19 Aug 2008 20:28:07 +0000 (22:28 +0200)
cli.c

diff --git a/cli.c b/cli.c
index b48567faf90bce689491514b54315897c708c9a3..fe999708a254fbf7cd43bc74935b768ecd3511f4 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -155,14 +155,24 @@ static void uci_show_changes(struct uci_package *p)
 
        uci_foreach_element(&p->saved_history, e) {
                struct uci_history *h = uci_to_history(e);
+               char *prefix = "";
+               char *op = "=";
 
-               if (h->cmd == UCI_CMD_REMOVE)
-                       printf("-");
-               printf("%s.%s", p->e.name, h->section);
+               switch(h->cmd) {
+               case UCI_CMD_REMOVE:
+                       prefix = "-";
+                       break;
+               case UCI_CMD_LIST_ADD:
+                       op = "+=";
+                       break;
+               default:
+                       break;
+               }
+               printf("%s%s.%s", prefix, p->e.name, h->section);
                if (e->name)
                        printf(".%s", e->name);
                if (h->cmd != UCI_CMD_REMOVE)
-                       printf("=%s", h->value);
+                       printf("%s%s", op, h->value);
                printf("\n");
        }
 }