generated from old4ever/rust-boilerplate
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -180,7 +180,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||
|
||||
[[package]]
|
||||
name = "moshy"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"env_logger",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "moshy"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
20
src/main.rs
20
src/main.rs
@@ -84,9 +84,23 @@ fn main() {
|
||||
if let Some(list_matches) = matches.subcommand_matches("list") {
|
||||
let sections: Vec<String> = conf
|
||||
.sections()
|
||||
.filter_map(|s| s.map(|x| x.to_string()))
|
||||
.filter_map(|s| s)
|
||||
.filter(|s| *s != "DEFAULT")
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
if list_matches.is_present("verbose") {
|
||||
for section in §ions {
|
||||
println!("[{}]", section);
|
||||
if let Some(sec) = conf.section(Some(section)) {
|
||||
for (k, v) in sec.iter() {
|
||||
println!("{} = {}", k, v);
|
||||
}
|
||||
}
|
||||
println!();
|
||||
}
|
||||
} else {
|
||||
println!("{}", sections.join("\n"));
|
||||
}
|
||||
process::exit(0);
|
||||
}
|
||||
|
||||
@@ -174,7 +188,9 @@ fn parse_hostname(hostname_argument: &str, conf: &Ini) -> HostSetup {
|
||||
|
||||
let sections: Vec<String> = conf
|
||||
.sections()
|
||||
.filter_map(|s| s.map(|x| x.to_string()))
|
||||
.filter_map(|s| s)
|
||||
.filter(|s| *s != "DEFAULT")
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
debug!("Config sections: {:?}", sections);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user