From bfa93363f3e8533ef352cad38c2adfa21dbc28a3 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sat, 17 Feb 2018 23:15:57 +0700 Subject: Add Config_tree.render_at_level function for correct rendering of configs for human consumption. The idea of the correct (for subsequent parsing) and familiar for all other purposes rendering: * When rendering the entire config, do not render the invisible "root" node, only render its children. * When rendering config at specified path, do not include any nodes that are within the path (e.g. if path "system login" exists, "show system" request output should start with "login {", not "system { login { ..."). --- src/config_tree.mli | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/config_tree.mli') diff --git a/src/config_tree.mli b/src/config_tree.mli index f724df1..f72eda9 100644 --- a/src/config_tree.mli +++ b/src/config_tree.mli @@ -56,10 +56,20 @@ val is_ephemeral : t -> string list -> bool *) val render : ?indent:int -> - ?reftree:Reference_tree.t -> + ?reftree:(Reference_tree.t option)-> ?cmp:(string -> string -> int) -> ?showephemeral:bool -> ?showinactive:bool -> t -> string +val render_at_level : + ?indent:int -> + ?reftree:(Reference_tree.t option)-> + ?cmp:(string -> string -> int) -> + ?showephemeral:bool -> + ?showinactive:bool -> + t -> + string list -> + string + -- cgit v1.2.3