docs: update

This commit is contained in:
iff 2025-01-07 01:52:35 +01:00
parent 5b98d3badc
commit 195aa34f95
3 changed files with 12 additions and 1 deletions

View file

@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Wrong starting distance when including all candidates - Wrong starting distance when including all candidates
- Spacings for `opt` placeholder - Spacings for `opt` placeholder
### Changed
- Merged `exes` placeholder of last version into new `select` placeholder
## [0.6.9] - 2025-01-06 ## [0.6.9] - 2025-01-06
### Added ### Added

View file

@ -38,6 +38,13 @@ Your module should print:
- At the end of each suggestion, append `<_PR_BR>` so pay-respects knows you are either done or adding another suggestion - At the end of each suggestion, append `<_PR_BR>` so pay-respects knows you are either done or adding another suggestion
- **To `stderr`**: Any relevant information that should display to the user (e.g, warning for AI generated content) - **To `stderr`**: Any relevant information that should display to the user (e.g, warning for AI generated content)
An example of a shell based module that always adds a `sudo` before the command:
```sh
#!/bin/sh
echo "sudo $_PR_LAST_COMMAND"
echo "<_PR_BR>"
```
## Adding a Module ## Adding a Module
Expose your module as executable (`chmod u+x`) in `PATH`, and done! Expose your module as executable (`chmod u+x`) in `PATH`, and done!

View file

@ -57,7 +57,7 @@ The placeholder is evaluated as following:
- `{{command[1]}}`: The first argument of the command (the command itself has index of 0). Negative values will count from reverse. - `{{command[1]}}`: The first argument of the command (the command itself has index of 0). Negative values will count from reverse.
- `{{command[2:5]}}`: The second to fifth arguments. If any of the side is not specified, then it defaults to the start (if it is left) or the end (if it is right). - `{{command[2:5]}}`: The second to fifth arguments. If any of the side is not specified, then 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, or the `{{shell}}` placeholder, among others. - `{{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, or the `{{shell}}` placeholder, among others.
- `{{exes[<index>]}}`: Special case for executables, will create multiple suggestions for each match with the same linguistic distance. Currently, only can appear once to avoid recursions. - `{{select[3][selection1, selection2]}}`: A derivative of `typo` placeholder. Will create a suggestion for each selection in the parenthesis. The argument in parentheses also must have at least 2 values. Single arguments are reserved for specific selections, for instance, `path` to search all commands found in the `$PATH` environment with the minimum linguistic distance, or the `{{shell}}` placeholder.
- `{{opt::<Regular Expression>}}`: Optional patterns captured in the command with RegEx ([see regex crate for syntax](https://docs.rs/regex-lite/latest/regex_lite/#syntax)). Note that all patterns matching this placeholder will be removed from indexing. - `{{opt::<Regular Expression>}}`: Optional patterns captured in the command with RegEx ([see regex crate for syntax](https://docs.rs/regex-lite/latest/regex_lite/#syntax)). Note that all patterns matching this placeholder will be removed from indexing.
- `{{cmd::<Regular Expression>}}`: Get the matching captures from the last command. Unlike `{{opt}}`, this won't remove the string after matching - `{{cmd::<Regular Expression>}}`: Get the matching captures from the last command. Unlike `{{opt}}`, this won't remove the string after matching
- `{{err::<Regular Expression}}`: Get the matching captures from the error message. - `{{err::<Regular Expression}}`: Get the matching captures from the error message.