pay-respects/README.md

101 lines
3.6 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
2023-07-31 21:38:04 +02:00
The binary is named `pay-respects`, by adding an alias to your shell
2023-07-30 18:40:18 +02:00
configuration:
``` shell
2023-07-30 22:10:55 +02:00
# Note: You may need to have the binary exposed in your path
2023-08-05 03:22:05 +02:00
alias f="$(pay-respects <your_shell_here>)"
2023-07-31 14:22:20 +02:00
# for example, using `zsh`:
2023-08-05 03:22:05 +02:00
alias f="$(pay-respects zsh)"
2023-07-31 21:12:57 +02:00
2023-08-04 15:40:45 +02:00
# Alternatively, you can also use the following initialization in your config file
# for bash and zsh
2023-08-05 03:22:05 +02:00
eval "$(pay-respects <shell> --alias)"
2023-08-04 15:40:45 +02:00
# for fish
2023-08-05 03:22:05 +02:00
pay-respects fish --alias | source
2023-08-04 15:40:45 +02:00
2023-07-31 21:12:57 +02:00
# for `nushell`, the alias can be added automatically with:
2023-08-05 03:22:05 +02:00
pay-respects nushell
2023-07-30 18:40:18 +02:00
```
2023-07-31 21:38:04 +02:00
You can now **press `F` to Pay Respects**!
2023-07-30 18:40:18 +02:00
2023-07-31 15:06:30 +02:00
Currently, only corrections to `bash`, `zsh`, and `fish` are working flawlessly.
2024-09-24 18:47:31 +02:00
`nushell` is currently usable, but there is no alias expansion, and you will have to put the evaluated initialization command in your config file (added automatically with `pay-respects nushell`). In addition, commands that need to be evaluated in the current working shell (such as `cd`) cannot yet be implemented in `nushell`.
2024-10-19 16:53:16 +02:00
Shell is not obtained automatically through environment variables because it won't work with nested shells, e.g. `fish` inside `zsh` still has `SHELL=zsh`.
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-17 14:24:37 +01:00
For generic x86 Linux desktop, you can get the binary from [releases](https://github.com/iffse/pay-respects/releases).
```shell
2024-11-17 15:06:14 +01:00
# download latest release
2024-11-17 14:24:37 +01:00
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")
2024-11-17 15:06:14 +01:00
# extract zip, e.g. one of the following
7z -x pay-respects.zip
unzip pay-respects.zip
2024-11-17 14:24:37 +01:00
# system-wide installation
sudo chmod a+x pay-respects
sudo mv pay-respects /usr/local/bin/pay-respects
2024-11-17 15:06:14 +01:00
# delete downloaded package
rm pay-respects.zip
2024-11-17 14:24:37 +01:00
```
If you have cargo installed, you can compile it from source (should work regardless of operating system or architecture):
2024-09-24 18:47:31 +02:00
```shell
# install from crates.io
2024-11-15 20:11:26 +01:00
# enabling runtime-rules is optional
cargo install pay-respects --features=runtime-rules
2024-09-24 18:47:31 +02:00
2024-11-17 14:24:37 +01:00
# clone from git and install
# suitable for adding custom compile-time rules
2024-09-24 18:47:31 +02:00
git clone --depth 1 https://github.com/iffse/pay-respects
cd pay-respects
cargo install --path .
2023-07-30 22:10:55 +02:00
2024-09-25 01:22:45 +02:00
# compile without installing
# binary can be found at ./target/release/pay-respects
2024-09-24 18:47:31 +02:00
cargo build --release
```
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)