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