From a8da70556c76b4bc84ed98f9ca34e2348cb38c8c Mon Sep 17 00:00:00 2001 From: MrVym Date: Tue, 28 Nov 2023 09:13:50 +0100 Subject: [PATCH] [CLI] Implement the cli argument with the env value --- src/cli/mod.rs | 34 +++++++++++++++++++++++++++++++--- src/main.rs | 3 +-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 84661e9..7b3ca06 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -4,7 +4,35 @@ use clap::Parser; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] pub struct Args { - /// The url of the broker - #[arg(short, long)] - pub mqtt_server: String, + /// The url of the broker + #[arg(long, env)] + pub mqtt_server: String, + + /// The minimum limit of the speed + #[arg(long, env)] + pub speed_limit_min: u16, + + /// The maximum limit of the speed + #[arg(long, env)] + pub speed_limit_max: u16, + + /// The diameter of the wheels + #[arg(long, env)] + pub wheel_diameter: u16, + + /// The gaps between every wheels + #[arg(long, env)] + pub wheel_gaps: u16, + + /// The value Kp Ki Kd rho theta phi + #[clap(long, value_parser, num_args = 6, value_delimiter = ' ', env)] + pub pid_linear: Vec, + + /// TODO: Add argument + #[arg(long, env)] + pub lidar_pose: u16, + + /// TODO: Add argument + #[arg(long, env)] + pub lidar_resolution: u16, } diff --git a/src/main.rs b/src/main.rs index f2415c5..a1051c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ - pub mod cli; use bevy::prelude::*; @@ -12,6 +11,6 @@ fn hello_world() { fn main() { dotenvy::dotenv().ok(); let args = Args::parse(); - println!("Hello {}!", args.mqtt_server); + println!("{:#?}", args); App::new().add_systems(Startup, hello_world).run(); }