Function nereon::configure [−][src]
pub fn configure<T, U: IntoIterator<Item = I>, I: Into<OsString> + Clone>(
nos: &str,
args: U
) -> Result<T, String> where
T: FromValue,
Parse command-line options into a Value
.
Examples
use std::collections::HashMap; use nereon::{Value, parse_noc, configure, FromValue}; let nos = r#" name "Nereon test" authors ["John Doe <john@doe.me>"] version "0.0.1" license Free option username { short u long user env NEREON_USER default admin hint USER usage "User name" key [username] }"#; let expected = Value::Table(HashMap::new()) .insert(vec!["username"], Value::from("root")); assert_eq!(configure::<Value, _, _>(nos, &["program", "-u", "root"]), Ok(expected));