mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-13 14:33:47 +00:00
stash: allow controlling verbosity from the command line
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a69641d5d727b1d95f8c9e2b851b3a194315a
This commit is contained in:
parent
d8d27fab22
commit
c23c5af8c1
3 changed files with 19 additions and 1 deletions
|
|
@ -37,6 +37,9 @@ struct Cli {
|
|||
|
||||
#[arg(long)]
|
||||
db_path: Option<PathBuf>,
|
||||
|
||||
#[command(flatten)]
|
||||
verbosity: clap_verbosity_flag::Verbosity,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
|
|
@ -73,8 +76,11 @@ enum Command {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
let cli = Cli::parse();
|
||||
env_logger::Builder::new()
|
||||
.filter_level(cli.verbosity.into())
|
||||
.init();
|
||||
|
||||
let db_path = cli.db_path.unwrap_or_else(|| {
|
||||
dirs::cache_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("/tmp"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue