diff --git a/crates/sprout-cli/src/commands/channels.rs b/crates/sprout-cli/src/commands/channels.rs index d23b26b87c..6d70925a62 100644 --- a/crates/sprout-cli/src/commands/channels.rs +++ b/crates/sprout-cli/src/commands/channels.rs @@ -1,6 +1,8 @@ use uuid::Uuid; -use crate::client::{extract_d_tag, extract_p_tags, normalize_write_response, print_create_response, SproutClient}; +use crate::client::{ + extract_d_tag, extract_p_tags, normalize_write_response, print_create_response, SproutClient, +}; use crate::error::CliError; use crate::validate::{parse_uuid, read_or_stdin, validate_hex64, validate_uuid}; @@ -103,7 +105,8 @@ pub async fn cmd_get_channel(client: &SproutClient, channel_id: &str) -> Result< let events: Vec = serde_json::from_str(&resp).unwrap_or_default(); if let Some(e) = events.first() { let mut normalized = extract_channel_metadata(e); - normalized["pubkey"] = serde_json::json!(e.get("pubkey").and_then(|v| v.as_str()).unwrap_or("")); + normalized["pubkey"] = + serde_json::json!(e.get("pubkey").and_then(|v| v.as_str()).unwrap_or("")); println!("{normalized}"); } else { println!("null"); @@ -123,10 +126,7 @@ pub async fn cmd_list_channel_members( }); let resp = client.query(&filter).await?; let events: Vec = serde_json::from_str(&resp).unwrap_or_default(); - let members = events - .first() - .map(extract_p_tags) - .unwrap_or_default(); + let members = events.first().map(extract_p_tags).unwrap_or_default(); let output = serde_json::to_string(&members).unwrap_or_default(); println!("{output}"); Ok(()) @@ -140,7 +140,11 @@ pub async fn cmd_get_canvas(client: &SproutClient, channel_id: &str) -> Result<( }); let resp = client.query(&filter).await?; let events: Vec = serde_json::from_str(&resp).unwrap_or_default(); - if let Some(content) = events.first().and_then(|e| e.get("content")).and_then(|c| c.as_str()) { + if let Some(content) = events + .first() + .and_then(|e| e.get("content")) + .and_then(|c| c.as_str()) + { println!("{content}"); } else { println!("null"); diff --git a/crates/sprout-cli/src/commands/dms.rs b/crates/sprout-cli/src/commands/dms.rs index 3fd9cfc1a4..cb59358fc6 100644 --- a/crates/sprout-cli/src/commands/dms.rs +++ b/crates/sprout-cli/src/commands/dms.rs @@ -63,11 +63,9 @@ pub async fn cmd_open_dm(client: &SproutClient, pubkeys: &[String]) -> Result<() use nostr::{EventBuilder, Kind, Tag}; let mut tags: Vec = refs .iter() - .map(|pk| Tag::parse(&["p", pk]) - .map_err(|e| CliError::Other(format!("tag error: {e}")))) + .map(|pk| Tag::parse(&["p", pk]).map_err(|e| CliError::Other(format!("tag error: {e}")))) .collect::, _>>()?; - tags.push(Tag::parse(&["d", &dm_id]) - .map_err(|e| CliError::Other(format!("tag error: {e}")))?); + tags.push(Tag::parse(&["d", &dm_id]).map_err(|e| CliError::Other(format!("tag error: {e}")))?); let builder = EventBuilder::new(Kind::Custom(41010), "", tags); let event = client.sign_event(builder)?; diff --git a/crates/sprout-cli/src/commands/reactions.rs b/crates/sprout-cli/src/commands/reactions.rs index 57664f61d5..2ed3a0aacd 100644 --- a/crates/sprout-cli/src/commands/reactions.rs +++ b/crates/sprout-cli/src/commands/reactions.rs @@ -107,7 +107,9 @@ pub async fn cmd_get_reactions(client: &SproutClient, event_id: &str) -> Result< }) .collect(); reactions.sort_by(|a, b| { - a.get("emoji").and_then(|v| v.as_str()).unwrap_or("") + a.get("emoji") + .and_then(|v| v.as_str()) + .unwrap_or("") .cmp(b.get("emoji").and_then(|v| v.as_str()).unwrap_or("")) });