summaryrefslogtreecommitdiff
path: root/examples/simple.rs
blob: 72ccf1fed3af06792a92f79f3105e3e869d95636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use pom_parser::Configuration;
use std::process::ExitCode;

fn try_main() -> Result<(), Box<dyn std::error::Error>> {
	let conf = Configuration::load_path("examples/conf.pom")?;
	println!("tab width is {}", conf.get_int_or_default("tab-size", 8)?);
	println!(
		"indenting with {}",
		conf.get_or_default("indentation-type", "tabs")
	);
	println!(
		"show line numbers: {}",
		conf.get_bool_or_default("show-line-numbers", false)?
	);
	println!(
		"edit-over-ssh plug-in path: {:?}",
		conf.get("plug-in.edit-over-ssh.path")
	);
	println!("C++ extensions: {:?}", conf.get_list("file-extensions.Cpp"));
	Ok(())
}

fn main() -> ExitCode {
	if let Err(e) = try_main() {
		eprintln!("Error: {e}");
		return ExitCode::FAILURE;
	}
	ExitCode::SUCCESS
}