From 195aa34f95112e8b77d7b0c6bcd31609549afa73 Mon Sep 17 00:00:00 2001 From: iff Date: Tue, 7 Jan 2025 01:52:35 +0100 Subject: [PATCH] docs: update --- CHANGELOG.md | 4 ++++ modules.md | 7 +++++++ rules.md | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16b5490..f956d07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 - Spacings for `opt` placeholder +### Changed + +- Merged `exes` placeholder of last version into new `select` placeholder + ## [0.6.9] - 2025-01-06 ### Added diff --git a/modules.md b/modules.md index 82898fa..b01d423 100644 --- a/modules.md +++ b/modules.md @@ -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 - **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 Expose your module as executable (`chmod u+x`) in `PATH`, and done! diff --git a/rules.md b/rules.md index 8f71a12..cf4e18d 100644 --- a/rules.md +++ b/rules.md @@ -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[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. - - `{{exes[]}}`: 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::}}`: 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::}}`: Get the matching captures from the last command. Unlike `{{opt}}`, this won't remove the string after matching - `{{err::