diff --git a/hooked-cli/source/cli/install.rs b/hooked-cli/source/cli/install.rs index d8582eb..e40bad8 100644 --- a/hooked-cli/source/cli/install.rs +++ b/hooked-cli/source/cli/install.rs @@ -15,6 +15,7 @@ use crate::{cli::InstallArgs, DEFAULT_TEMPLATE, HOOK_TYPES}; /// The `install` subcommand. pub fn hooked_install(config: Config, args: InstallArgs) -> Result<()> { + let silent = args.silent; let git_hooks_dir = PathBuf::from(".git/hooks/"); if !git_hooks_dir.exists() { return Err(eyre!("The \".git/hooks/\" directory does not exist")); @@ -28,10 +29,12 @@ pub fn hooked_install(config: Config, args: InstallArgs) -> Result<()> { let hook_path = git_hooks_dir.join(hook_type); if hook_path.exists() && !args.overwrite { - println!( - "{:?} exists, use --overwrite to replace the existing file", - hook_path - ); + if !silent { + println!( + "{:?} exists, use --overwrite to replace the existing file", + hook_path + ); + } continue; } diff --git a/hooked-cli/source/cli/mod.rs b/hooked-cli/source/cli/mod.rs index f23965a..86b619a 100644 --- a/hooked-cli/source/cli/mod.rs +++ b/hooked-cli/source/cli/mod.rs @@ -56,6 +56,10 @@ pub struct InstallArgs { /// Overwrite existing files. #[clap(long)] pub overwrite: bool, + + /// Don't output any information. + #[clap(long)] + pub silent: bool, } /// The `uninstall` subcommand arguments. diff --git a/shell.nix b/shell.nix index 1cc6d72..72ad086 100644 --- a/shell.nix +++ b/shell.nix @@ -28,6 +28,6 @@ mkShell rec { cargo install --path hooked-cli --root $out fi - hooked install + hooked install --silent ''; }