Skip to content

Commit

Permalink
Add cmd line options to control color output and nb of worker threads
Browse files Browse the repository at this point in the history
  • Loading branch information
erebe committed Dec 20, 2023
1 parent debe4c7 commit 89c8405
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ use url::{Host, Url};
struct Wstunnel {
#[command(subcommand)]
commands: Commands,

/// Disable color output in logs
#[arg(long, global = true, verbatim_doc_comment, env = "NO_COLOR")]
no_color: Option<String>,

/// *WARNING* The flag does nothing, you need to set the env variable *WARNING*
/// Control the number of threads that will be used.
/// By default it is equal the number of cpus
#[arg(
long,
global = true,
value_name = "INT",
verbatim_doc_comment,
env = "TOKIO_WORKER_THREADS"
)]
nb_worker_threads: Option<u32>,
}

#[derive(clap::Subcommand, Debug)]
Expand Down Expand Up @@ -546,7 +562,7 @@ async fn main() {
> 0 => {}
_ => {
tracing_subscriber::fmt()
.with_ansi(true)
.with_ansi(args.no_color.is_none())
.with_env_filter(
EnvFilter::builder()
.with_default_directive(Level::INFO.into())
Expand Down

0 comments on commit 89c8405

Please sign in to comment.