pay-respects/README.md

148 lines
3.9 KiB
Markdown
Raw Normal View History

2023-07-31 21:38:04 +02:00
# Pay Respects
2023-07-30 18:40:18 +02:00
2023-08-04 03:04:26 +02:00
Typed a wrong command? Pay Respects will try to correct your wrong console command by simply pressing `F`!
2023-07-30 18:40:18 +02:00
2023-08-04 03:18:31 +02:00
- 🚀 **Blazing fast suggestion**: You won't notice any delay for asking suggestions!
2024-11-15 20:11:26 +01:00
- ✏️ **Easy to write rules**: You don't need to know Rust. The rules are written in a TOML file that is simple to work with and can be evaluated to Rust code upon compilation! Optional runtime user defined rules can be enabled starting from 0.5!
2023-08-13 17:51:43 +02:00
- 🎯 **Accurate results**: Suggestions must pass several conditions in order to be prompted to the user, no `sudo` suggestions when you are using `doas`!
2023-08-04 03:18:31 +02:00
- 🪶 **Tiny binary size**: Not even 1MB!
2023-08-13 17:51:43 +02:00
![pacman-fix](img/pacman-fix.png)
2023-08-05 00:56:46 +02:00
2023-08-13 17:51:43 +02:00
![cd-fix](img/cd-fix.png)
2023-07-31 19:25:19 +02:00
2023-07-31 21:38:04 +02:00
## How to Pay Respects
2023-07-30 18:40:18 +02:00
Please follow the instruction for your shell:
<details>
2024-11-18 14:53:10 +01:00
<summary>Bash / Zsh / Fish</summary>
2023-07-31 14:22:20 +02:00
> Manual aliasing:
2024-11-18 15:29:45 +01:00
> ```shell
> alias f="$(pay-respects bash)"
> alias f="$(pay-respects zsh)"
2024-11-18 14:53:10 +01:00
> alias f="$(pay-respects fish)"
> ```
> Auto aliasing (optional custom alias can be added after `--alias argument`):
2024-11-18 15:29:45 +01:00
> ```shell
> eval "$(pay-respects bash --alias)"
> eval "$(pay-respects zsh --alias)"
> pay-respects fish --alias | source
> ```
2023-08-04 15:40:45 +02:00
</details>
<details>
<summary>Nushell</summary>
2024-11-18 14:53:10 +01:00
> Add the following output to your configuration file:
> ```shell
> pay-respects nushell [--alias <alias>]
> ```
2023-07-30 18:40:18 +02:00
> Or save it as a file:
2024-11-18 14:53:10 +01:00
> ```shell
> pay-respects nushell [--alias <alias>] | save -f ~/.pay-respects.nu
> ```
> and source from your config file:
2024-11-18 14:53:10 +01:00
> ```shell
> source ~/.pay-respects.nu
> ```
2023-07-31 15:06:30 +02:00
</details>
2024-11-18 22:21:51 +01:00
<details>
<summary>Custom initialization for arbitrary shell</summary>
> pay-respects only requires 2 environment variables to function:
>
> - `_PR_SHELL`: The binary name of the current working shell.
> - `_PR_LAST_COMMAND`: The last command.
>
> pay-respects echos back, if applicable, a `cd` command that can be evaluated by the current working shell.
>
> General example:
> ```shell
> eval $(_PR_SHELL=sh _PR_LAST_COMMAND="git comit" pay-respects)
> ```
</details>
You can now **press `F` to Pay Respects**!
2024-10-19 16:53:16 +02:00
2023-07-30 22:10:55 +02:00
## Installing
2024-11-16 23:27:35 +01:00
Install from your package manager if available:
[![Packaging status](https://repology.org/badge/vertical-allrepos/pay-respects.svg)](https://repology.org/project/pay-respects/versions)
2023-07-30 22:10:55 +02:00
2024-11-18 15:29:45 +01:00
Compiled binaries can be found at [GitHub releases](https://github.com/iffse/pay-respects/releases).
<details>
<summary>Generic x86 Desktop Linux</summary>
> 1. Get the latest binary from [releases](https://github.com/iffse/pay-respects/releases).
> ```shell
> curl -sL -o pay-respects.zip \
> $(curl -s https://api.github.com/repos/iffse/pay-respects/releases/latest \
> | sed 's/[()",{}]/ /g; s/ /\n/g' \
> | grep "https.*pay-respects-ubuntu-latest.zip")
> ```
>
> 2. Extract zip, e.g. one of the following:
> ```shell
> 7z -x pay-respects.zip
> unzip pay-respects.zip
> ```
>
> 3. System-wide installation:
> ```shell
> sudo chmod a+x pay-respects
> sudo mv pay-respects /usr/local/bin/pay-respects
> ```
>
> 4. Delete the downloaded package:
> ```shell
> rm pay-respects.zip
> ```
</details>
<details>
<summary>Compile from source (any OS/architecture)</summary>
> This installation requires you to have Cargo (the Rust package manager) installed.
>
> Install from [crates.io](https://crates.io/), `runtime-rules` is optional:
> ```shell
> cargo install pay-respects --features=runtime-rules
> ```
>
> Clone from git and install, suitable for adding custom compile-time rules:
> ```
> git clone --depth 1 https://github.com/iffse/pay-respects
> cd pay-respects
> cargo install --path .
> ```
2024-09-24 18:47:31 +02:00
</details>
2023-07-30 20:08:28 +02:00
## Rule Files
2024-11-15 20:11:26 +01:00
See [writing rules](./rules.md) for how to write rules.
2023-07-30 20:08:28 +02:00
2024-11-15 20:11:26 +01:00
## Contributing
2023-07-30 18:40:18 +02:00
2023-08-04 03:04:26 +02:00
Current option to write rules should cover most of the cases.
We need more rule files, contributions are welcomed!
2023-07-30 18:40:18 +02:00
2024-10-19 18:30:10 +02:00
This project is hosted at various sites, choose the one that suits you best:
- [Codeberg](https://codeberg.org/iff/pay-respects)
- [GitHub](https://github.com/iffse/pay-respects)
- [GitLab](https://gitlab.com/iffse/pay-respects)