Command suggestions, command-not-found and thefuck replacement written in Rust https://codeberg.org/iff/pay-respects
Find a file
2024-11-22 21:04:12 +01:00
.github ci: add arm linux 2024-11-22 21:04:12 +01:00
i18n i18n: update 2024-11-21 17:56:54 +01:00
rules rules: enhance cp, mv 2024-11-21 15:23:07 +01:00
src feat: optional libcurl linking 2024-11-22 19:21:03 +01:00
.gitignore add: cargo.lock 2024-11-13 16:32:53 +01:00
.rustfmt.toml init 2023-07-30 18:40:18 +02:00
Cargo.lock v0.5.13 2024-11-22 14:34:01 +01:00
Cargo.toml feat: optional libcurl linking 2024-11-22 19:21:03 +01:00
install.sh feat: install script 2024-11-22 14:34:01 +01:00
LICENSE doc: appending the full license notice 2023-08-09 00:14:54 +02:00
README.md feat: install script 2024-11-22 14:34:01 +01:00
rules.md docs: update rules 2024-11-21 17:38:52 +01:00

Pay Respects

Typed a wrong command or don't know what to do? Pay Respects will suggest a fix to your console command by simply pressing F!

  • 🚀 Blazing fast suggestion: You won't notice any delay for asking suggestions!
  • ✏️ Easy to write rules: You don't need to know Rust. The rules are written in a TOML file!
  • 🎯 Accurate results: Suggestions are verified before being prompted to the user, no sudo suggestions when you are using doas!
  • 🤖 AI Support: AI comes in aid when there is no rule for your error!
  • 🪶 Tiny binary size: Not even 1MB! Approximately 1MB with all optional features!

pacman-fix

cd-fix

How to Pay Respects

Please follow the instruction for your shell:

Bash / Zsh / Fish

Manual aliasing:

alias f="$(pay-respects bash)"
alias f="$(pay-respects zsh)"
alias f="$(pay-respects fish)"

Auto aliasing (optional custom alias can be added after --alias):

eval "$(pay-respects bash --alias)"
eval "$(pay-respects zsh --alias)"
pay-respects fish --alias | source
Nushell

Add the following output to your configuration file:

pay-respects nushell [--alias <alias>]

Or save it as a file:

pay-respects nushell [--alias <alias>] | save -f ~/.pay-respects.nu

and source from your config file:

source ~/.pay-respects.nu
Custom initialization for arbitrary shell

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:

eval $(_PR_SHELL=sh _PR_LAST_COMMAND="git comit" pay-respects)

You can now press F to Pay Respects!

Installing

Install from your package manager if available:

Packaging status

Or install compiled binaries from GitHub releases with the install script:

curl -sSfL https://raw.githubusercontent.com/iffse/pay-respects/main/install.sh | sh
Compile from source (any OS/architecture)

This installation requires you to have Cargo (the Rust package manager) installed.

Install from crates.io, features are optional

cargo install pay-respects --features=runtime-rules,request-ai

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 .

Rule Files

See writing rules for how to write rules.

AI Integration

Disclaimer: You are using AI generated content on your own risk. Please double-check its suggestions before accepting.

AI suggestions should work out of the box unless rate limit has reached. Bring your own API keys to avoid it.

If it's useful to you, please share this project and spread the word. Also consider making a donation to keep its public usage alive:

Donate using Liberapay Donate using Ko-fi
Donate using Stripe Donate using PayPal
AI and API Configuration

Configuration is done via environment variables:

  • _PR_AI_API_KEY: Your own API key
  • _PR_AI_URL: URL used. Defaults to https://api.groq.com/openai/v1/chat/completions
  • _PR_AI_MODEL: Model used. Defaults to llama3-8b-8192
  • _PR_AI_DISABLE: Setting to any value disables AI integration
  • _PR_AI_LOCALE: Locale in which the AI explains the suggestion. Defaults to user system locale

Compile time variables:

  • _DEF_PR_AI_API_KEY: Default API key, included in compile-time

Contributing

Current option to write rules should cover most of the cases.

We need more rule files, contributions are welcomed!

This project is hosted at various sites, choose the one that suits you best: