feat: add --quiet cli argument

To silence log outputs on the CLI.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
This commit is contained in:
Thomas Mühlbacher 2024-06-27 13:53:41 +02:00
parent df09682869
commit 176d76bceb
2 changed files with 10 additions and 2 deletions

View File

@ -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,
@ -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);

View File

@ -250,6 +250,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,
@ -379,7 +383,7 @@ pub fn mount(mut argv: Vec<String>, symlink_cmd: Option<&str>) -> i32 {
let cli = Cli::parse_from(argv);
// TODO: centralize this on the top level CLI
logging::setup(false, cli.verbose, cli.colorize);
logging::setup(cli.quiet, cli.verbose, cli.colorize);
if let Err(e) = cmd_mount_inner(&cli) {
error!("Fatal error: {}", e);