Skip to content

Commit

Permalink
feat: Add --quiet option to backup and forget (#964)
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome authored Dec 10, 2023
1 parent 6f573f5 commit b8e0e40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/commands/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/commands/forget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit b8e0e40

Please sign in to comment.