From 2d8206436bbcc3b78c7d6296dd3df1bd3af1a4fb Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 16 May 2024 13:57:32 -0700 Subject: cli: fix update command --- adenosine-cli/src/bin/adenosine.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/adenosine-cli/src/bin/adenosine.rs b/adenosine-cli/src/bin/adenosine.rs index e2f6994..5d287ee 100644 --- a/adenosine-cli/src/bin/adenosine.rs +++ b/adenosine-cli/src/bin/adenosine.rs @@ -241,7 +241,7 @@ enum Command { fields: Vec, /// Whether to authenticate #[structopt(long)] - auth: bool + auth: bool, }, /// Manage user account and sessions @@ -472,10 +472,11 @@ fn run(opt: Opt) -> Result<()> { params.insert("collection".to_string(), collection.clone()); params.insert("rkey".to_string(), rkey.clone()); // fetch existing, extend map with fields, put the updated value - let mut record = xrpc_client + let mut resp = xrpc_client .get(&Nsid::from_str("com.atproto.repo.getRecord")?, Some(params))? .unwrap_or(json!({})); - update_value_from_fields(fields.clone(), &mut record); + let record = &mut resp["value"]; + update_value_from_fields(fields.clone(), record); xrpc_client.post( &Nsid::from_str("com.atproto.repo.putRecord")?, None, @@ -518,9 +519,7 @@ fn run(opt: Opt) -> Result<()> { let body = value_from_fields(fields.clone()); match method { XrpcMethod::Get => xrpc_client.get(nsid, Some(params))?, - XrpcMethod::Post => { - xrpc_client.post(nsid, Some(params), Some(body))? - } + XrpcMethod::Post => xrpc_client.post(nsid, Some(params), Some(body))?, } } Command::Account { -- cgit v1.2.3