[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] [PATCH] * src/augtool.c: new 'load' command



---
 src/augtool.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/augtool.c b/src/augtool.c
index 2e7ba6a..af6b0df 100644
--- a/src/augtool.c
+++ b/src/augtool.c
@@ -239,6 +239,22 @@ static int cmd_save(ATTRIBUTE_UNUSED char *args[]) {
     return r;
 }
 
+static int cmd_load(ATTRIBUTE_UNUSED char *args[]) {
+    int r;
+    r = aug_load(aug);
+    if (r == -1) {
+        printf("Loading failed\n");
+    } else {
+        r = aug_match(aug, "/augeas/events/saved", NULL);
+        if (r > 0) {
+            printf("Saved %d file(s)\n", r);
+        } else if (r < 0) {
+            printf("Error during match: %d\n", r);
+        }
+    }
+    return r;
+}
+
 static int cmd_ins(char *args[]) {
     const char *label = args[0];
     const char *where = args[1];
@@ -373,6 +389,9 @@ static const struct command const commands[] = {
       "Save all pending changes to disk. For now, files are not overwritten.\n"
       "        Instead, new files with extension .augnew are created"
     },
+    { "load", 0, 0, cmd_load, "load",
+      "Load files accordig to the transforms in /augeas/load."
+    },
     { "help", 0, 0, cmd_help, "help",
       "Print this help text"
     },
-- 
1.6.0.6



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]