Crates.io | xpanda |
lib.rs | xpanda |
version | 0.1.0 |
source | src |
created_at | 2022-10-02 18:47:13.866919 |
updated_at | 2022-10-02 18:47:13.866919 |
description | Unix shell-like parameter expansion/variable substitution |
homepage | https://github.com/aesy/xpanda |
repository | https://github.com/aesy/xpanda |
max_upload_size | |
id | 678513 |
size | 104,452 |
First create a new Xpanda
struct using the builder:
use xpanda::Xpanda;
let xpanda = Xpanda::builder()
// ...
.build();
or use the default implementation:
let xpanda = Xpanda::default();
The default implementation sources values from environment variables and ignores unset variables (leaving an empty string).
The Xpanda
struct implements a single method, expand
, which will return a copy of the given string expanded
according to the pattern rules. For example:
assert_eq!(xpanda.expand("${1:-default}"), Ok(String::from("default")));
The API Reference provides more details.
Add xpanda
manually as a dependency in your Cargo.toml
file or use the cargo add command:
cargo add xpanda
The Minimum Supported Rust Version is currently 1.63
.