Skip to content

Commit ddef4ae

Browse files
committed
prefer_recent option
1 parent 055b32c commit ddef4ae

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

client/src/bin/space-cli.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,17 +261,18 @@ enum Commands {
261261
SignEvent {
262262
/// Space name (e.g., @example)
263263
space: String,
264-
265264
/// Path to a Nostr event json file (omit for stdin)
266265
#[arg(short, long)]
267266
input: Option<PathBuf>,
267+
/// Prefer the most recent trust path (not recommended)
268+
#[arg(long)]
269+
prefer_recent: bool,
268270
},
269271
/// Verify a signed Nostr event against the space's public key
270272
#[command(name = "verifyevent")]
271273
VerifyEvent {
272274
/// Space name (e.g., @example)
273275
space: String,
274-
275276
/// Path to a signed Nostr event json file (omit for stdin)
276277
#[arg(short, long)]
277278
input: Option<PathBuf>,
@@ -283,6 +284,9 @@ enum Commands {
283284
space: String,
284285
/// The DNS zone file path (omit for stdin)
285286
input: Option<PathBuf>,
287+
/// Prefer the most recent trust path (not recommended)
288+
#[arg(long)]
289+
prefer_recent: bool,
286290
},
287291
/// Updates the Merkle trust path for space-anchored Nostr events
288292
#[command(name = "refreshanchor")]
@@ -836,20 +840,28 @@ async fn handle_commands(cli: &SpaceCli, command: Commands) -> Result<(), Client
836840
cli.client.verify_listing(listing).await?;
837841
println!("{} Listing verified", "✓".color(Color::Green));
838842
}
839-
Commands::SignEvent { space, input } => {
843+
Commands::SignEvent {
844+
space,
845+
input,
846+
prefer_recent,
847+
} => {
840848
let space = normalize_space(&space);
841849
let event = read_event(input)
842850
.map_err(|e| ClientError::Custom(format!("input error: {}", e.to_string())))?;
843851

844-
let result = cli.sign_event(space, event, false).await?;
852+
let result = cli.sign_event(space, event, prefer_recent).await?;
845853
println!("{}", serde_json::to_string(&result).expect("result"));
846854
}
847-
Commands::SignZone { space, input } => {
855+
Commands::SignZone {
856+
space,
857+
input,
858+
prefer_recent,
859+
} => {
848860
let space = normalize_space(&space);
849861
let event = encode_dns_update(input)
850862
.map_err(|e| ClientError::Custom(format!("Parse error: {}", e)))?;
851863

852-
let result = cli.sign_event(space, event, false).await?;
864+
let result = cli.sign_event(space, event, prefer_recent).await?;
853865
println!("{}", serde_json::to_string(&result).expect("result"));
854866
}
855867
Commands::RefreshAnchor {

0 commit comments

Comments
 (0)