summaryrefslogtreecommitdiff
path: root/src/session.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-12-17 11:54:20 -0600
committerJohn Estabrook <jestabro@vyos.io>2025-12-17 21:29:58 -0600
commitf58bfaa3487ef821466e35fbd2bb073732e889dd (patch)
treec1c340dc190d2595cc1e1ec8447f163ce56610b2 /src/session.ml
parent28b6ac04aaef995656eaabb2c9a279a79e657687 (diff)
downloadvyconf-f58bfaa3487ef821466e35fbd2bb073732e889dd.tar.gz
vyconf-f58bfaa3487ef821466e35fbd2bb073732e889dd.zip
T8061: add get_completion_env request
Return help strings and values in the form used by bash completion.
Diffstat (limited to 'src/session.ml')
-rw-r--r--src/session.ml14
1 files changed, 14 insertions, 0 deletions
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