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.
§Breaking Changes
split("")now returns[]instead of[""]. Empty or whitespace-only input yields an empty vector.
§Documentation
The latest documentation is always available at docs.rs.
Structs§
- Environment
Provider - A VariableProvider that reads variable values from the environment.
- Expand
Options - Configuration for which variable syntax forms are accepted during expansion.
- Prefixing
Variable Provider - A VariableProvider that prepends a prefix before lookup.
Enums§
- Error
- An error occurred during expansion or quoting operations.
Traits§
- Variable
Provider - A VariableProvider provides a way to lookup the value of a variable.
- Variable
Witness - 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 - Recursively expand variables until no more expansions are possible.
- expand_
recursive_ with_ options - Recursively expand variables with custom options until no more expansions are possible.
- expand_
with_ options - Expand the input with custom options to a shell-quoted string suitable for passing to
split. - 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.
- rcvar_
with_ options - Return a vector of the variables in use by this script with custom options.
- 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.
- split_
once - Parse a single shell-quoted argument from the input.