Crate shvar

Source
Expand description

§shvar

shvar is the SHell VARiable expansion library.

§Status

Maintenance track. The library is considered stable and will be put into maintenance mode if unchanged for one year.

§Scope

This library provides the quote, split, expand, and rcvar functions.

§Warts

  • A string with '{' and '}' characters outside the variable declarations won’t parse right now.

§Documentation

The latest documentation is always available at docs.rs.

Structs§

EnvironmentProvider
A VariableProvider that reads variable values from the environment.
PrefixingVariableProvider
A VariableProvider that prepends a prefix before lookup.

Enums§

Error
An error occurred during expansion or quoting operations.

Traits§

VariableProvider
A VariableProvider provides a way to lookup the value of a variable.
VariableWitness
A VariableWitness collects the identifiers of variables in use in a string.

Functions§

awkward_quote_string
Awkwardly quote the string.
double_quote_string
Put the string in double quotes, escaping ‘$’, ‘`’, ‘“’, ‘\’, and ‘\n’.
expand
Expand the input to a shell-quoted string suitable for passing to split.
expand_recursive
quote
Quote the pieces in such a way that splitting the quoted string will return the original pieces.
quote_string
Quote the string using double quotes, single quotes, or awkward quotes.
rcvar
Return a vector of the variables in use by this script.
single_quote_string
Single quote the provided string, if it contains no single-quote characters.
split
Split the string in a way that respects quoting rules.