shellexpand is a single dependency library which allows one to perform shell-like expansions in strings,
that is, to expand variables like $A
or ${B}
into their values inside some context and to expand
~
in the beginning of a string into the home directory (again, inside some context).
This crate provides generic functions which accept arbitrary contexts as well as default, system-based
functions which perform expansions using the system-wide context (represented by functions from std::env
module and dirs crate).
Just add a dependency in your Cargo.toml
:
toml
[dependencies]
shellexpand = "1.1.1"
See the crate documentation (a link is present in the beginning of this readme) for more information and examples.
dirs
dependency to 2.0.std::env::home_dir
to the dirs::home_dir functionhome_dir
argument type for tilde expansion functions to FnOnce
instead FnMut
LookupError::name
field name to var_name
This program is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.