Skip to main content

expand_completion

Function expand_completion 

Source
pub fn expand_completion(pattern: &str) -> Result<String, CliTableError>
Expand description

Expand [[...]] completion syntax to regex pattern.

Each character inside [[...]] becomes optionally matched, building from left to right.

§Examples

assert_eq!(expand_completion("sh[[ow]]").unwrap(), "sh(o(w)?)?");
assert_eq!(expand_completion("sh[[ow]] ver[[sion]]").unwrap(), "sh(o(w)?)? ver(s(i(o(n)?)?)?)?");
assert_eq!(expand_completion("no completion").unwrap(), "no completion");