chore: Take the ownership in the CommandRunner trait
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
@@ -103,7 +103,7 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CommandRunner for Commands {
|
impl CommandRunner for Commands {
|
||||||
async fn run(&self, options: CliOptions) -> N34Result<()> {
|
async fn run(self, options: CliOptions) -> N34Result<()> {
|
||||||
tracing::trace!("Options: {options:#?}");
|
tracing::trace!("Options: {options:#?}");
|
||||||
tracing::trace!("Handling: {self:#?}");
|
tracing::trace!("Handling: {self:#?}");
|
||||||
match self {
|
match self {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ pub enum RepoSubcommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CommandRunner for RepoSubcommands {
|
impl CommandRunner for RepoSubcommands {
|
||||||
async fn run(&self, options: CliOptions) -> N34Result<()> {
|
async fn run(self, options: CliOptions) -> N34Result<()> {
|
||||||
match self {
|
match self {
|
||||||
Self::View(args) => args.run(options).await,
|
Self::View(args) => args.run(options).await,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ pub struct ViewArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CommandRunner for ViewArgs {
|
impl CommandRunner for ViewArgs {
|
||||||
async fn run(&self, options: CliOptions) -> N34Result<()> {
|
async fn run(self, options: CliOptions) -> N34Result<()> {
|
||||||
let client = NostrClient::init(&options).await;
|
let client = NostrClient::init(&options).await;
|
||||||
if !self.naddr.relays.is_empty() {
|
if !self.naddr.relays.is_empty() {
|
||||||
client.add_read_relays(&self.naddr.relays).await;
|
client.add_read_relays(&self.naddr.relays).await;
|
||||||
|
|||||||
@@ -20,5 +20,5 @@ use crate::error::N34Result;
|
|||||||
/// A trait defining the interface for command runners in the CLI.
|
/// A trait defining the interface for command runners in the CLI.
|
||||||
pub trait CommandRunner {
|
pub trait CommandRunner {
|
||||||
/// Executes the command and returns a Result indicating success or failure.
|
/// Executes the command and returns a Result indicating success or failure.
|
||||||
async fn run(&self, options: CliOptions) -> N34Result<()>;
|
async fn run(self, options: CliOptions) -> N34Result<()>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user