Crates.io | shellexpand-fork |
lib.rs | shellexpand-fork |
version | 2.1.2 |
source | src |
created_at | 2022-03-02 12:04:50.589033 |
updated_at | 2022-08-05 14:28:40.802974 |
description | Shell-like expansions in strings |
homepage | |
repository | https://gitlab.com/ijackson/rust-shellexpand |
max_upload_size | |
id | 542221 |
size | 59,852 |
NOTE: THIS CRATE NAME IS RETIRED. There will no further updates beyond 2.1.2.
Please switch to shellexpand
, which will continue to be developed.
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).
Note: This package was a fork of Vladimir Matveev's library.
This fork existed due to a hiatus in maintenance.
Please use shellexpand
instead now.
expanduser
:
Tilde substitution only.
Supports ~user
which this crate currently does not
(although we hope to).envsubst
:
Does not do offer tildeexpansion.
Only supports certain concrete types
(eg HashMap
for variable map).expand_str
:
Uses %..%
syntax.
Does not offer tilde expansion.
Variable lookups can only be infallible.tilde_expand
:
Only does tilde expansion, on bytes ([u8]
).Add a dependency in your Cargo.toml
.
To avoid having to write use shellexpand_fork as shellexpand
or similar,
rename the package on import:
[dependencies]
shellexpand = { version = "2.1", package = "shellexpand-fork" }
See the crate documentation (a link is present in the beginning of this readme) for more information and examples.
Minor changes:
shellexpand
cargo fix
.shellexpand-fork
on crates.io.dirs-next
instead of the obsolete dirs
as the underlying dependency used to resolve the home directory${ANSWER:-42}
)dyn
for trait objects to fix deprecation warningsource()
instead of cause()
in the Error
implementation, and
therefore added a 'static
bound for the generic error parameter E
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.