Type Alias DefaultParameterSubstitution

Source
pub type DefaultParameterSubstitution = ParameterSubstitution<DefaultParameter, TopLevelWord<String>, TopLevelCommand<String>, DefaultArithmetic>;
Expand description

Type alias for the default ParameterSubstitution representation.

Aliased Type§

pub enum DefaultParameterSubstitution {
    Command(Vec<TopLevelCommand<String>>),
    Len(Parameter<String>),
    Arith(Option<Arithmetic<String>>),
    Default(bool, Parameter<String>, Option<TopLevelWord<String>>),
    Assign(bool, Parameter<String>, Option<TopLevelWord<String>>),
    Error(bool, Parameter<String>, Option<TopLevelWord<String>>),
    Alternative(bool, Parameter<String>, Option<TopLevelWord<String>>),
    RemoveSmallestSuffix(Parameter<String>, Option<TopLevelWord<String>>),
    RemoveLargestSuffix(Parameter<String>, Option<TopLevelWord<String>>),
    RemoveSmallestPrefix(Parameter<String>, Option<TopLevelWord<String>>),
    RemoveLargestPrefix(Parameter<String>, Option<TopLevelWord<String>>),
}

Variants§

§

Command(Vec<TopLevelCommand<String>>)

Returns the standard output of running a command, e.g. $(cmd)

§

Len(Parameter<String>)

Returns the length of the value of a parameter, e.g. ${#param}

§

Arith(Option<Arithmetic<String>>)

Returns the resulting value of an arithmetic subsitution, e.g. $(( x++ ))

§

Default(bool, Parameter<String>, Option<TopLevelWord<String>>)

Use a provided value if the parameter is null or unset, e.g. ${param:-[word]}. The boolean indicates the presence of a :, and that if the parameter has a null value, that situation should be treated as if the parameter is unset.

§

Assign(bool, Parameter<String>, Option<TopLevelWord<String>>)

Assign a provided value to the parameter if it is null or unset, e.g. ${param:=[word]}. The boolean indicates the presence of a :, and that if the parameter has a null value, that situation should be treated as if the parameter is unset.

§

Error(bool, Parameter<String>, Option<TopLevelWord<String>>)

If the parameter is null or unset, an error should result with the provided message, e.g. ${param:?[word]}. The boolean indicates the presence of a :, and that if the parameter has a null value, that situation should be treated as if the parameter is unset.

§

Alternative(bool, Parameter<String>, Option<TopLevelWord<String>>)

If the parameter is NOT null or unset, a provided word will be used, e.g. ${param:+[word]}. The boolean indicates the presence of a :, and that if the parameter has a null value, that situation should be treated as if the parameter is unset.

§

RemoveSmallestSuffix(Parameter<String>, Option<TopLevelWord<String>>)

Remove smallest suffix pattern from a parameter’s value, e.g. ${param%pattern}

§

RemoveLargestSuffix(Parameter<String>, Option<TopLevelWord<String>>)

Remove largest suffix pattern from a parameter’s value, e.g. ${param%%pattern}

§

RemoveSmallestPrefix(Parameter<String>, Option<TopLevelWord<String>>)

Remove smallest prefix pattern from a parameter’s value, e.g. ${param#pattern}

§

RemoveLargestPrefix(Parameter<String>, Option<TopLevelWord<String>>)

Remove largest prefix pattern from a parameter’s value, e.g. ${param##pattern}