diff options
author | John Estabrook <jestabro@vyos.io> | 2022-02-08 21:10:56 -0600 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2022-02-08 21:10:56 -0600 |
commit | eb2ec50dea6fa47326cbbe65b47c31a3a86836ba (patch) | |
tree | d396d6f5fdf81ae48d99982954f0232803103660 | |
parent | 297612c64230008228f77806e575c3831e15476e (diff) | |
download | libvyosconfig-eb2ec50dea6fa47326cbbe65b47c31a3a86836ba.tar.gz libvyosconfig-eb2ec50dea6fa47326cbbe65b47c31a3a86836ba.zip |
configtree: T4235: allow rendering delete commands
-rw-r--r-- | lib/bindings.ml | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/bindings.ml b/lib/bindings.ml index 40ef120..484a5d7 100644 --- a/lib/bindings.ml +++ b/lib/bindings.ml @@ -46,8 +46,12 @@ let render_json c_ptr = let render_json_ast c_ptr = CT.render_json_ast (Root.get c_ptr) -let render_commands c_ptr = - CT.render_commands (Root.get c_ptr) [] +let render_commands c_ptr op = + match op with + | "delete" -> + CT.render_commands ~op:CT.Delete (Root.get c_ptr) [] + | _ -> + CT.render_commands ~op:CT.Set (Root.get c_ptr) [] let set_add_value c_ptr path value = let ct = Root.get c_ptr in @@ -180,7 +184,7 @@ struct let () = I.internal "to_string" ((ptr void) @-> returning string) render_config let () = I.internal "to_json" ((ptr void) @-> returning string) render_json let () = I.internal "to_json_ast" ((ptr void) @-> returning string) render_json_ast - let () = I.internal "to_commands" ((ptr void) @-> returning string) render_commands + let () = I.internal "to_commands" ((ptr void) @-> string @-> returning string) render_commands let () = I.internal "set_add_value" ((ptr void) @-> string @-> string @-> returning int) set_add_value let () = I.internal "set_replace_value" ((ptr void) @-> string @-> string @-> returning int) set_replace_value let () = I.internal "set_valueless" ((ptr void) @-> string @-> returning int) set_valueless |