extern crate sloggers; #[macro_use] extern crate slog; use preftool::*; use preftool_app_config::*; use preftool_clap::*; use preftool_clap_derive::*; use preftool_toml::*; use sloggers::terminal::{Destination, TerminalLoggerBuilder}; use sloggers::types::Severity; use sloggers::Build; #[derive(ClapConfig)] pub struct Server { #[preftool_clap(help = "Server host")] host: String, #[preftool_clap(help = "Server port")] port: usize, #[preftool_clap(help = "Server certificate (enables TLS)")] cert: Option, } fn main() -> std::io::Result<()> { let mut builder = TerminalLoggerBuilder::new(); builder.level(Severity::Debug); builder.destination(Destination::Stdout); let log = builder.build().unwrap(); info!(log, "Program args: {:#?}", std::env::args_os()); let config = AppConfigBuilder::new("preftool-app-config-simple", Some(log))? .with_args::() .configure(|app| app.version("0.0.1")) .add_format(TomlConfigFormat) .build()?; println!("{:#?}", config); Ok(()) }