Skip to main content

Crate toargv_template

Crate toargv_template 

Source
Expand description

Argument templates for toargv.

The crate parses an ordered argv template and expands paths from a serde_json::Value configuration tree into command-line arguments.

use serde_json::json;
use toargv_template::{Template, expand};

let template = Template::parse(&[
    "--output".to_owned(),
    "{output}".to_owned(),
    "{input}".to_owned(),
])?;
let arguments = expand(
    &json!({"output": "result.txt", "input": "source.txt"}),
    &template,
)?;

assert_eq!(arguments, ["--output", "result.txt", "source.txt"]);

Re-exports§

pub use error::Error;
pub use expand::expand;
pub use path::ConfigPath;
pub use template::Template;

Modules§

error
Errors returned by template parsing and expansion.
expand
Argument expansion from configuration values.
path
Paths into JSON-compatible configuration trees.
template
The validated argv template model and parser.