diff options
-rw-r--r-- | src/config_tree.ml | 9 | ||||
-rw-r--r-- | src/config_tree.mli | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/config_tree.ml b/src/config_tree.ml index 6ae7ad2..3e97e80 100644 --- a/src/config_tree.ml +++ b/src/config_tree.ml @@ -101,6 +101,15 @@ let is_tag node path = let data = Vytree.get_data node path in data.tag +let get_subtree ?(with_node=false) node path = + try + let n = Vytree.get node path in + if with_node then + Vytree.make_full default_data "root" [n] + else + Vytree.make_full default_data "root" (Vytree.children_of_node n) + with Vytree.Nonexistent_path -> make "root" + module Renderer = struct (* Rendering configs as set commands *) diff --git a/src/config_tree.mli b/src/config_tree.mli index cf94af7..5375c23 100644 --- a/src/config_tree.mli +++ b/src/config_tree.mli @@ -34,6 +34,8 @@ val set_tag : t -> string list -> bool -> t val is_tag : t -> string list -> bool +val get_subtree : ?with_node:bool -> t -> string list -> t + val render_commands : ?op:command -> t -> string list -> string val render_config : t -> string |