shellexpand, a library for shell-like expansion in strings

Build Status crates.io docs

Documentation

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).


Alternatives to this crate:

Usage

Just add a dependency in your Cargo.toml:

toml [dependencies] shellexpand = "3.0"

See the crate documentation (a link is present in the beginning of this readme) for more information and examples.

Cargo features

Functional features:

Metafeatures:

At the time of writing there is no experimental or hazardous functionality; if we introduce any it will be feature gated and not enabled by default nor part of full. Requiring base-0 allows us to split existing functionality into a new optional feature, without a semver break.

Changelog

Version 3.0.0 - 2022-12-01

Breaking changes:

Significant changes:

Version 2.1.2

Minor changes:

Version 2.1.1

Version 2.1.0

Version 2.0.0

Version 1.1.1

Version 1.1.0

Version 1.0.0

Version 0.1.0

License

This program is licensed under either of

at your option.

Contribution

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.