feat: Add --quiet option to backup and forget (#964)

This commit is contained in:
aawsome 2023-12-11 00:41:03 +01:00 committed by GitHub
parent 6f573f517b
commit b8e0e40eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -57,6 +57,11 @@ pub struct BackupCmd {
#[merge(strategy = merge::bool::overwrite_false)]
json: bool,
/// Don't show any output
#[clap(long, conflicts_with = "json")]
#[merge(strategy = merge::bool::overwrite_false)]
quiet: bool,
/// Initialize repository, if it doesn't exist yet
#[clap(long)]
#[merge(strategy = merge::bool::overwrite_false)]
@ -224,7 +229,7 @@ impl BackupCmd {
if opts.json {
let mut stdout = std::io::stdout();
serde_json::to_writer_pretty(&mut stdout, &snap)?;
} else {
} else if !opts.quiet {
let summary = snap.summary.unwrap();
println!(
"Files: {} new, {} changed, {} unchanged",

View File

@ -30,6 +30,10 @@ pub(super) struct ForgetCmd {
#[clap(long)]
json: bool,
/// Don't show any output
#[clap(long, conflicts_with = "json")]
quiet: bool,
/// Forget options
#[clap(flatten)]
config: ForgetOptions,
@ -122,7 +126,7 @@ impl ForgetCmd {
if self.json {
let mut stdout = std::io::stdout();
serde_json::to_writer_pretty(&mut stdout, &groups)?;
} else {
} else if !self.quiet {
print_groups(&groups);
}