mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-03-11 00:00:03 +03:00
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:
parent
df09682869
commit
176d76bceb
@ -152,6 +152,10 @@ pub struct Cli {
|
|||||||
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
|
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
|
||||||
colorize: bool,
|
colorize: bool,
|
||||||
|
|
||||||
|
/// Quiet mode
|
||||||
|
#[arg(short, long)]
|
||||||
|
quiet: bool,
|
||||||
|
|
||||||
/// Verbose mode
|
/// Verbose mode
|
||||||
#[arg(short, long, action = clap::ArgAction::Count)]
|
#[arg(short, long, action = clap::ArgAction::Count)]
|
||||||
verbose: u8,
|
verbose: u8,
|
||||||
@ -201,7 +205,7 @@ pub fn list(argv: Vec<String>) -> i32 {
|
|||||||
let opt = Cli::parse_from(argv);
|
let opt = Cli::parse_from(argv);
|
||||||
|
|
||||||
// TODO: centralize this on the top level CLI
|
// 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) {
|
if let Err(e) = cmd_list_inner(&opt) {
|
||||||
error!("Fatal error: {}", e);
|
error!("Fatal error: {}", e);
|
||||||
|
@ -250,6 +250,10 @@ pub struct Cli {
|
|||||||
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
|
#[arg(short, long, action = clap::ArgAction::Set, default_value_t=stdout().is_terminal())]
|
||||||
colorize: bool,
|
colorize: bool,
|
||||||
|
|
||||||
|
/// Quiet mode
|
||||||
|
#[arg(short, long)]
|
||||||
|
quiet: bool,
|
||||||
|
|
||||||
/// Verbose mode
|
/// Verbose mode
|
||||||
#[arg(short, long, action = clap::ArgAction::Count)]
|
#[arg(short, long, action = clap::ArgAction::Count)]
|
||||||
verbose: u8,
|
verbose: u8,
|
||||||
@ -379,7 +383,7 @@ pub fn mount(mut argv: Vec<String>, symlink_cmd: Option<&str>) -> i32 {
|
|||||||
let cli = Cli::parse_from(argv);
|
let cli = Cli::parse_from(argv);
|
||||||
|
|
||||||
// TODO: centralize this on the top level CLI
|
// 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) {
|
if let Err(e) = cmd_mount_inner(&cli) {
|
||||||
error!("Fatal error: {}", e);
|
error!("Fatal error: {}", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user