From efeb9d8227c0182c512491da977a7d535fd436e6 Mon Sep 17 00:00:00 2001 From: Ollo Date: Fri, 4 Apr 2025 18:56:41 +0200 Subject: [PATCH] INI File can be parsed --- .gitignore | 1 + client/bin/src/main.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a2783f3..ecd4045 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .vscode/launch.json .vscode/ipch todo.txt +*.ini diff --git a/client/bin/src/main.rs b/client/bin/src/main.rs index f6e2201..b9e4955 100644 --- a/client/bin/src/main.rs +++ b/client/bin/src/main.rs @@ -364,6 +364,9 @@ LEDboardClient " println!(""); println!("second argument is optional:"); println!(""); + println!(""); + println!("Config mode"); + println!("--mode config "); } fn check_connection(ipaddress: String) -> bool { @@ -401,7 +404,8 @@ struct Message { fn main_function(ipaddress: String, mqtt: Option, config: Option) -> ExitCode { // Read configuration file - if config.is_some() { + if ( (config.is_some()) && (mqtt.is_some()) && (ipaddress == "--mode") ) + { let i = Ini::load_from_file(config.clone().unwrap()).unwrap(); for (sec, prop) in i.iter() { println!("Section: {:?}", sec); @@ -409,6 +413,9 @@ fn main_function(ipaddress: String, mqtt: Option, config: Option println!("{}:{}", k, v); } } + + // FIXME stop here + return ExitCode::SUCCESS; } let mut device_online = check_connection(ipaddress.clone());