diff options
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/cli.rs | 10 | ||||
-rw-r--r-- | src/main.rs | 10 |
3 files changed, 19 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml index 2801952..7264004 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ anyhow = "1.0.86" chrono = { version = "0.4.38", features = ["alloc"] } clap = { version = "4.5.7", features = ["derive"] } convert_case = "0.6.0" -env_logger = "0.11.3" log = "0.4.21" serde = { version = "1.0.203", features = ["derive"] } serde_derive = "1.0.203" +stderrlog = "0.6.0" toml = "0.8.14" diff --git a/src/cli.rs b/src/cli.rs index fe1b194..9fee349 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,4 +1,4 @@ -use clap::{Parser, Subcommand}; +use clap::{ArgAction, Parser, Subcommand}; /// A project manager for LaTeX #[derive(Parser, Debug)] @@ -6,6 +6,14 @@ use clap::{Parser, Subcommand}; pub struct Args { #[command(subcommand)] pub cli: Command, + + /// Increase message verbosity + #[arg(long="verbose", short = 'v', action = ArgAction::Count)] + pub verbosity: u8, + + /// Silence all output + #[arg(long, short = 'q')] + pub quiet: bool, } #[derive(Subcommand, Debug)] diff --git a/src/main.rs b/src/main.rs index 8c2ea62..8d1c977 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,8 +22,16 @@ pub mod new; pub mod file_tree; fn main() -> anyhow::Result<()> { - env_logger::init(); let args = Args::parse(); + stderrlog::new() + .module(module_path!()) + .quiet(args.quiet) + .show_module_names(false) + .color(stderrlog::ColorChoice::Auto) + .verbosity(args.verbosity as usize) + .timestamp(stderrlog::Timestamp::Off) + .init() + .expect("Let's just hope that this does not panic"); let project_root = get_project_root_by_lmp_toml().context("Looking for the project root")?; |