From 38c8a67dddc812d6064123da8ae658a038b9bff7 Mon Sep 17 00:00:00 2001 From: prma Date: Tue, 26 Dec 2023 16:22:26 +0330 Subject: [PATCH] fix: remove printer message from completions command this way the output command can be used to source completion --- src/cli.rs | 2 +- src/completion/command.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 407243e..0ebc5f8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -151,7 +151,7 @@ impl HimalayaCommand { cmd.execute(printer, &config).await } Self::Manual(cmd) => cmd.execute(printer).await, - Self::Completion(cmd) => cmd.execute(printer).await, + Self::Completion(cmd) => cmd.execute().await, } } } diff --git a/src/completion/command.rs b/src/completion/command.rs index 32b45b0..91b758d 100644 --- a/src/completion/command.rs +++ b/src/completion/command.rs @@ -4,7 +4,7 @@ use clap_complete::Shell; use log::info; use std::io; -use crate::{cli::Cli, printer::Printer}; +use crate::cli::Cli; /// Print completion script for a shell to stdout. /// @@ -19,17 +19,17 @@ pub struct CompletionGenerateCommand { } impl CompletionGenerateCommand { - pub async fn execute(self, printer: &mut impl Printer) -> Result<()> { + pub async fn execute(self) -> Result<()> { info!("executing completion generate command"); let mut cmd = Cli::command(); let name = cmd.get_name().to_string(); clap_complete::generate(self.shell, &mut cmd, name, &mut io::stdout()); - printer.print(format!( + info!( "Shell script successfully generated for shell {}!", self.shell - ))?; + ); Ok(()) }