2023-07-30 18:40:18 +02:00
# Pay Respect
Typed a wrong command? Pay Respect will try to correct your wrong console command simply by pressing `F` !
## How to Pay Respect
The binary is named `pay-respect` , by adding an alias to your shell
configuration:
``` shell
2023-07-30 22:10:55 +02:00
# Note: You may need to have the binary exposed in your path
2023-07-30 18:40:18 +02:00
alias f="pay_respect"
```
You can now **press `F` to Pay Respect** !
2023-07-30 22:10:55 +02:00
## Installing
If you are using Arch Linux, you can install from AUR directly:
```shell
paru -S pay_respect
```
Otherwise, you can use cargo to compile the project:
```
cargo build --release
```
and the binary can be found at `target/release/pay_respect` .
2023-07-30 20:08:28 +02:00
## Rule Files
Rule files are parsed at compilation. What actually gets compiled is a HashMap that contains patterns and suggestions for a specific command.
Syntax of a rule file (placed under [rules ](./rules )):
```toml
# this field should be the name of the command
command = "world"
2023-07-30 20:22:49 +02:00
# you can add as much section of this as you like
2023-07-30 20:08:28 +02:00
[[match_output]]
# the suggestion of this section will be used for the following patterns of the command output
pattern = [
"pattern 1",
"pattern 2",
]
2023-07-30 20:22:49 +02:00
# this will change the first argument to `fix`, while keeping the rest intact
2023-07-30 20:08:28 +02:00
suggest = "{{command[0]}} fix {{command[2:]}}"
[[match_output]]
pattern = [
"pattern 1",
]
# this will add a `sudo` before the command, without touching the rest
suggest = "sudo {{command}}"
```
The placeholder is evaluated as following:
- `{{command}}` : All the command without any modification
- `{{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).
2023-07-30 18:40:18 +02:00
## Current Progress
2023-07-30 20:22:49 +02:00
We need more rule files!
2023-07-30 18:40:18 +02:00