INI File can be parsed

This commit is contained in:
Ollo 2025-04-04 18:56:41 +02:00
parent 955bc37afe
commit efeb9d8227
2 changed files with 9 additions and 1 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
.vscode/launch.json
.vscode/ipch
todo.txt
*.ini

View File

@ -364,6 +364,9 @@ LEDboardClient <ip address>"
println!("<ip address>");
println!("second argument is optional:");
println!("<ip of mqtt server>");
println!("");
println!("Config mode");
println!("--mode config <file.ini>");
}
fn check_connection(ipaddress: String) -> bool {
@ -401,7 +404,8 @@ struct Message {
fn main_function(ipaddress: String, mqtt: Option<String>, config: Option<String>) -> 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<String>, config: Option<String>
println!("{}:{}", k, v);
}
}
// FIXME stop here
return ExitCode::SUCCESS;
}
let mut device_online = check_connection(ipaddress.clone());