summaryrefslogtreecommitdiffstats
path: root/cli/src/main.rs
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-04-25 17:41:52 +0200
committerHarald Eilertsen <haraldei@anduin.net>2024-04-25 17:41:52 +0200
commit975c0b735be0808883116616d934ee257a24fb08 (patch)
treed71dd46bb034674978cb204964f1cfa13dd5d5f1 /cli/src/main.rs
parentb7ff847c3c44df876fcc21e946ffff1eb781a4d9 (diff)
downloadfaktura-975c0b735be0808883116616d934ee257a24fb08.tar.gz
faktura-975c0b735be0808883116616d934ee257a24fb08.tar.bz2
faktura-975c0b735be0808883116616d934ee257a24fb08.zip
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.
Diffstat (limited to 'cli/src/main.rs')
-rw-r--r--cli/src/main.rs5
1 files changed, 5 insertions, 0 deletions
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<dyn std::error::Error>> {
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);
}