From 975c0b735be0808883116616d934ee257a24fb08 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 25 Apr 2024 17:41:52 +0200 Subject: cli: Add command to edit clients. Not entirely happy with this one. Specially the patch method of the Connection struct. While the other method take (or return) an object that can be serialized to json, the patch method takes a string slice directly, and passing it to the API. --- cli/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/src/main.rs') diff --git a/cli/src/main.rs b/cli/src/main.rs index ee10d17..794db9f 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -26,6 +26,11 @@ fn main() -> Result<(), Box> { add_client(conn, &args.next() .expect("expected new client json data"))?; }, + "--edit-client" => { + let client_id = args.next().expect("missing client id").parse()?; + let json = args.next().expect("missing json data"); + Client::update(conn, client_id, &json)?; + }, &_ => { println!("Unknown command: {}", cmd); } -- cgit v1.2.3