Skip to content

Commit

Permalink
feat: add --quiet cli argument
Browse files Browse the repository at this point in the history
To silence log outputs on the CLI.

Signed-off-by: Thomas Mühlbacher <[email protected]>
  • Loading branch information
tmuehlbacher committed Jun 28, 2024
1 parent c0d84a1 commit 82652b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/commands/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ pub struct Cli {
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
colorize: bool,

/// Quiet mode
#[arg(short, long)]
quiet: bool,

/// Verbose mode
#[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8,
Expand Down Expand Up @@ -201,7 +205,7 @@ pub fn list(argv: Vec<String>) -> i32 {
let opt = Cli::parse_from(argv);

// TODO: centralize this on the top level CLI
logging::setup(false, opt.verbose, opt.colorize);
logging::setup(opt.quiet, opt.verbose, opt.colorize);

if let Err(e) = cmd_list_inner(&opt) {
error!("Fatal error: {}", e);
Expand Down
6 changes: 5 additions & 1 deletion src/commands/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ pub struct Cli {
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
colorize: bool,

/// Quiet mode
#[arg(short, long)]
quiet: bool,

/// Verbose mode
#[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8,
Expand Down Expand Up @@ -388,7 +392,7 @@ pub fn mount(mut argv: Vec<String>, symlink_cmd: Option<&str>) -> i32 {
let opt = Cli::parse_from(argv);

// TODO: centralize this on the top level CLI
logging::setup(false, opt.verbose, opt.colorize);
logging::setup(opt.quiet, opt.verbose, opt.colorize);

if let Err(e) = cmd_mount_inner(opt) {
error!("Fatal error: {}", e);
Expand Down

0 comments on commit 82652b3

Please sign in to comment.