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/vyconfd.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/vyconfd.ml') diff --git a/src/vyconfd.ml b/src/vyconfd.ml index 96c2e42..d34deab 100644 --- a/src/vyconfd.ml +++ b/src/vyconfd.ml @@ -433,6 +433,17 @@ let get_path_type world token (req: request_get_path_type) = with Session.Session_error msg -> {response_tmpl with status=Fail; error=(Some msg)} +let get_completion_env world token (req: request_get_completion_env) = + let s = find_session token in + try + let node_type = + Session.get_completion_env + ~legacy_format:req.legacy_format world s req.path + in + {response_tmpl with output=(Some node_type)} + with Session.Session_error msg -> + {response_tmpl with status=Fail; error=(Some msg)} + let send_response oc resp = let enc = Pbrt.Encoder.create () in let%lwt () = encode_pb_response resp enc |> return in @@ -492,6 +503,7 @@ let rec handle_connection world ic oc () = | Some t, Config_unsaved r -> config_unsaved world t r | Some t, Reference_path_exists r -> reference_path_exists world t r | Some t, Get_path_type r -> get_path_type world t r + | Some t, Get_completion_env r -> get_completion_env world t r | _ -> failwith "Unimplemented" ) |> Lwt.return end -- cgit v1.2.3