Added Augeas.count_matches
[ocaml-augeas.git] / test_augeas.ml
index 0124b58..1be88b7 100644 (file)
 
 let () =
   let aug =
-    let loadpath = Some "/usr/share/augeas/lenses" in
+    let loadpath = None in
     let flags = [ Augeas.AugSaveBackup ] in
     Augeas.create "test_root" loadpath flags in
 
-  (* Print all files. *)
-  let files = Augeas.matches aug "/files/*" in
-  List.iter print_endline files;
-
-  (* Print all Augeas-metainfo. *)
-  let augs = Augeas.matches aug "/augeas/*" in
-  List.iter print_endline augs;
-
+  (* Print all files recursively. *)
+  let rec print path =
+    if path <> "" then print_endline path;
+    let files = List.sort compare (Augeas.matches aug (path ^ "/*")) in
+    List.iter print files
+  in
+  print "";
 
   (* Run the garbage collector to check for internal errors. *)
   Gc.compact ()