fix: remove printer message from completions command

this way the output command can be used to source completion
This commit is contained in:
prma 2023-12-26 16:22:26 +03:30 committed by Clément DOUIN
parent 89fbb8a9db
commit 38c8a67ddd
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
2 changed files with 5 additions and 5 deletions

View file

@ -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,
}
}
}

View file

@ -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(())
}