refactor: Improve commands running and make the signer optional for some commands

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb
2025-06-08 20:12:32 +00:00
parent 5dc8e31eb3
commit b1027b3b04
19 changed files with 107 additions and 51 deletions

View File

@@ -78,9 +78,9 @@ pub struct AnnounceArgs {
}
impl CommandRunner for AnnounceArgs {
async fn run(mut self, options: CliOptions) -> N34Result<()> {
options.ensure_relays()?;
const NEED_RELAYS: bool = true;
async fn run(mut self, options: CliOptions) -> N34Result<()> {
let relays = options.relays.clone().flat_relays(&options.config.sets)?;
let client = NostrClient::init(&options, &relays).await;
let user_pubk = options.pubkey().await?;

View File

@@ -38,9 +38,6 @@ pub enum RepoSubcommands {
impl CommandRunner for RepoSubcommands {
async fn run(self, options: CliOptions) -> N34Result<()> {
match self {
Self::View(args) => args.run(options).await,
Self::Announce(args) => args.run(options).await,
}
crate::run_command!(self, options, & View Announce)
}
}

View File

@@ -40,9 +40,9 @@ pub struct ViewArgs {
}
impl CommandRunner for ViewArgs {
async fn run(self, options: CliOptions) -> N34Result<()> {
// FIXME: The signer is not required here
const NEED_SIGNER: bool = false;
async fn run(self, options: CliOptions) -> N34Result<()> {
let naddrs = utils::naddrs_or_file(
self.naddrs.flat_naddrs(&options.config.sets)?,
&utils::nostr_address_path()?,