add arg_enum marker for verbosity arg

This commit is contained in:
Carson McManus 2022-06-19 12:47:07 -04:00
parent ed9cf91cfb
commit 5e3b2507ab

View file

@ -1,5 +1,5 @@
use std::str::FromStr; use std::str::FromStr;
use clap::Parser; use clap::{Parser, clap_derive::ArgEnum};
use clap_complete::Shell; use clap_complete::Shell;
#[derive(Debug, Clone, Parser)] #[derive(Debug, Clone, Parser)]
@ -14,7 +14,7 @@ pub(crate) struct Args {
pub mafiles_path: Option<String>, pub mafiles_path: Option<String>,
#[clap(short, long, help = "Specify your encryption passkey.")] #[clap(short, long, help = "Specify your encryption passkey.")]
pub passkey: Option<String>, pub passkey: Option<String>,
#[clap(short, long, default_value_t=Verbosity::Info, help = "Set the log level.")] #[clap(short, long, arg_enum, default_value_t=Verbosity::Info, help = "Set the log level.")]
pub verbosity: Verbosity, pub verbosity: Verbosity,
#[clap(subcommand)] #[clap(subcommand)]
@ -33,7 +33,7 @@ pub(crate) enum Subcommands {
Decrypt(ArgsDecrypt), Decrypt(ArgsDecrypt),
} }
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, ArgEnum)]
pub(crate) enum Verbosity { pub(crate) enum Verbosity {
Error = 0, Error = 0,
Warn = 1, Warn = 1,