summaryrefslogtreecommitdiff
path: root/src/vyconf_cli_compat.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-12-18 12:36:56 -0600
committerGitHub <noreply@github.com>2025-12-18 12:36:56 -0600
commit0f36d5a2650238d3bbd2b5837ec51fc0c01962aa (patch)
treec1c340dc190d2595cc1e1ec8447f163ce56610b2 /src/vyconf_cli_compat.ml
parentf6c35930530cc72794a3f7c7488422ccb604b7fd (diff)
parentf58bfaa3487ef821466e35fbd2bb073732e889dd (diff)
downloadvyconf-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/vyconf_cli_compat.ml')
-rw-r--r--src/vyconf_cli_compat.ml15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/vyconf_cli_compat.ml b/src/vyconf_cli_compat.ml
index 6ebd1f1..eb14136 100644
--- a/src/vyconf_cli_compat.ml
+++ b/src/vyconf_cli_compat.ml
@@ -10,6 +10,9 @@ type op_t =
| OpShowConfig
| OpSessionChanged
| OpConfigUnsaved
+ | OpReferencePathExists
+ | OpGetPathType
+ | OpGetCompletionEnv
let op_of_arg s =
match s with
@@ -21,6 +24,9 @@ let op_of_arg s =
| "showCfg" -> OpShowConfig
| "sessionChanged" -> OpSessionChanged
| "sessionUnsaved" -> OpConfigUnsaved
+ | "validateTmplPath" -> OpReferencePathExists
+ | "getNodeType" -> OpGetPathType
+ | "getCompletionEnv" -> OpGetCompletionEnv
| _ -> failwith (Printf.sprintf "Unknown operation %s" s)
let in_cli_config_session () =
@@ -91,6 +97,9 @@ let main op path =
| OpShowConfig -> show_config c path
| OpSessionChanged -> session_changed c
| OpConfigUnsaved -> config_unsaved c None
+ | OpReferencePathExists -> reference_path_exists c path
+ | OpGetPathType -> get_path_type c path
+ | OpGetCompletionEnv -> get_completion_env c path
end
| Error e -> Error e |> Lwt.return
in
@@ -128,7 +137,11 @@ let () =
with Failure msg -> let () = print_endline msg in exit 1
in
match op, path_list with
- | OpSetEditLevel, [] ->
+ | OpSetEditLevel, []
+ | OpReferencePathExists, []
+ | OpGetPathType, [] ->
let () = print_endline "Must specify config path" in exit 1
+ | OpGetCompletionEnv, [] | OpGetCompletionEnv, [_] ->
+ let () = print_endline "Must specify command and at least one component" in exit 1
| _, _ ->
let result = Lwt_main.run (main op path_list) in exit result