mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 15:45:11 +01:00
feat: regex matching
This commit is contained in:
parent
a5762bf121
commit
3e367a09dd
8 changed files with 85 additions and 93 deletions
|
|
@ -82,7 +82,7 @@ The placeholder is evaluated as following:
|
|||
- `{{command[1]}}`: The first argument of the command (the command itself has index of 0)
|
||||
- `{{command[2:5]}}`: The second to fifth arguments. If any of the side is not specified, them it defaults to the start (if it is left) or the end (if it is right).
|
||||
- `{{typo[2](fix1, fix2)}}`: This will try to change the second argument to candidates in the parenthesis. The argument in parentheses must have at least 2 values. Single arguments are reserved for specific matches, for instance, `path` to search all commands found in the `$PATH` environment.
|
||||
- `{{opt(fix1, -*)}}`: Optional patterns that are found in the command. Note that all patterns matching this placeholder will not take a place when indexing (for example, in `rm {{opt(-r)}} file` the index of the file is always 1 regardless where `-r` was placed by the user).
|
||||
- `{{opt::<Regular Expression>}}`: Optional patterns that are found in the command with RegEx (see RegEx crate for syntax). Note that all patterns matching this placeholder will not take a place when indexing.
|
||||
|
||||
The suggestion can have additional conditions to check. To specify the conditions, add a `#[...]` at the first line (just like derive macros in Rust). Available conditions:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue