diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-12-18 12:36:56 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-18 12:36:56 -0600 |
| commit | 0f36d5a2650238d3bbd2b5837ec51fc0c01962aa (patch) | |
| tree | c1c340dc190d2595cc1e1ec8447f163ce56610b2 /src/session.ml | |
| parent | f6c35930530cc72794a3f7c7488422ccb604b7fd (diff) | |
| parent | f58bfaa3487ef821466e35fbd2bb073732e889dd (diff) | |
| download | vyconf-0f36d5a2650238d3bbd2b5837ec51fc0c01962aa.tar.gz vyconf-0f36d5a2650238d3bbd2b5837ec51fc0c01962aa.zip | |
Merge pull request #39 from jestabro/vyconf-completion-env
T8061: Add requests of analogues of cli-shell-api completion functions
Diffstat (limited to 'src/session.ml')
| -rw-r--r-- | src/session.ml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/session.ml b/src/session.ml index 478c423..0bd3d95 100644 --- a/src/session.ml +++ b/src/session.ml @@ -391,6 +391,26 @@ let config_unsaved w s file id = with Session_error _ -> true (* false positive on unlikely error *) in remove_file tmp_save; res +let reference_path_exists w _s path = + RT.reference_path_exists w.reference_tree 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 |
