From 861001a2e1a60945bdaae146743edad3b67948ce Mon Sep 17 00:00:00 2001 From: Martin HART Date: Tue, 20 Oct 2020 12:48:28 +0200 Subject: [PATCH 1/2] Add flags --- src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.rs b/src/main.rs index 234818d..37f9595 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use clap::{App, Arg}; use std::fs; use std::io; @@ -111,6 +112,18 @@ fn open_file(filename: &str) -> io::Result { } fn main() -> Result<(), Box> { + let matches = App::new("DancingDroids") + .version("0.1.0") + .about("When droids dance togethers") + .arg( + Arg::with_name("file") + .short("f") + .long("file") + .takes_value(true) + .help("Configuration file"), + ) + .get_matches(); + let mut robot_pool: Vec = Vec::new(); let raw_conf = open_file("two_robots.txt")?; Ok(()) From 857bd2c0917ca350baf82635ccc405242b307a24 Mon Sep 17 00:00:00 2001 From: Martin HART Date: Tue, 20 Oct 2020 12:50:05 +0200 Subject: [PATCH 2/2] Add the lib Clap 2.33.3 to dependencies --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index b582548..863e846 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,4 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +clap = "2.33.3"