From f58bfaa3487ef821466e35fbd2bb073732e889dd Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 17 Dec 2025 11:54:20 -0600 Subject: T8061: add get_completion_env request Return help strings and values in the form used by bash completion. --- src/session.ml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/session.ml') diff --git a/src/session.ml b/src/session.ml index f924591..0bd3d95 100644 --- a/src/session.ml +++ b/src/session.ml @@ -397,6 +397,20 @@ let reference_path_exists w _s path = let get_path_type ?(legacy_format=false) w _s path = RT.get_path_type_str ~legacy_format w.reference_tree path +let get_completion_env ?(legacy_format=false) w s path = + let op, path = + match path with + | [] -> raise (Session_error "Missing op and path") + | h :: tl -> (h, tl) + in + let config = get_proposed_config w s in + let res = + Vyos1x.Completion.get_completion_env_str ~legacy_format w.reference_tree config op path + in + match res with + | Ok env -> env + | Error e -> raise (Session_error e) + let write_running_cache w = (* alert exn Internal.write_internal: [Internal.Write_error] caught -- cgit v1.2.3