概要
コマンド候補の提示と command-not-found の処理に対応し、thefuck の代替として Rust で書かれています。
開発ツール計測したスター増加
- 24時間
- +1
- 7日間
- +2
- 15日間
- +4
- 1か月
- +8
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルPay Respects
Your command failed. Press F for it and get back to work!
- 🚀 Performant: Sub-millisecond (<1ms) performance! See the benchmarks.
- 🎯 Accurate: No blind guesses. Suggestions are checked first!
- ✏️ Rules in TOML: Write fixes without touching Rust!
- 🔩 Extendable: Go full Rust, use interpreted scripts, or build a module when TOML is not enough!
- 🤖 Optional AI: No rule? Let AI take a shot!
- 🪶 Small binary: Under 1 MB for core features!

How to Pay Respects
Pick your shell:
Bash / Zsh / Fish / Dash
Add the matching line to your shell configuration file:
eval "$(pay-respects bash --alias)" eval "$(pay-respects zsh --alias)" pay-respects fish --alias | source eval "$(pay-respects dash --alias)"Arguments:
--alias [alias]: Command name, defaults tof--shell-type <type>: Shell type when the binary name differs--nocnf: Disable thecommand_not_foundhandlerThe shell binary name is detected automatically. Use
--shell-typefor forks such aspay-respects zsh-fork --shell-type zsh.Dash has no inline mode or command-not-found handler.
Xonsh
Add this line to
~/.xonshrc:execx($(pay-respects xonsh --alias), 'exec', __xonsh__.ctx, filename='pay-respects')
Ctrl-XCtrl-Xruns inline mode when prompt_toolkit is available.
Elvish
Add this line to
~/.config/elvish/rc.elv:eval (pay-respects elvish --alias | slurp)Type
fto suggest a fix.Ctrl-Xruns inline mode. Elvish has no command-not-found handler.
Nushell
Add the generated lines to your Nushell config:
# replace `nu` with `nush` or `nushell` if your binary has a different name pay-respects nu --alias [<alias>]
Or save them to a file and source it:
pay-respects nu --alias [<alias>] | save -f ~/.pay-respects.nu source ~/.pay-respects.nu
PowerShell
Add the generated lines to your profile:
# replace `pwsh` with `powershell` if your binary has a different name pay-respects pwsh --alias [<alias>]
Or append them directly:
pay-respects pwsh --alias [<alias>] >> $PROFILE
Custom initialization for any shell
pay-respects needs two environment variables:
_PR_SHELL: Binary name of the current shell_PR_LAST_COMMAND: Last commandpay-respects prints commands that the shell should evaluate, such as
cd.Example:
eval $(_PR_SHELL=zsh-fork _PR_SHELL_TYPE=zsh _PR_LAST_COMMAND="git comit" pay-respects)
These variables are optional. They let pay-respects skip work:
_PR_SHELL_TYPE: Shell type. Auto-detected from_PR_SHELLif absent._PR_ALIAS: Aliases to commands, separated by newlines in zsh format, for examplegc=git commit_PR_ERROR_MSG: Error message from the previous command. If absent, pay-respects reads it from a multiplexer log or reruns the command._PR_EXECUTABLES: Space-separated list of executables. If absent, pay-respects scans$PATH._PR_LOG: Debug builds only. Write debug logs tostderror a file path.1writespay-respects.login the current directory. Unset disables logs._PR_LOG_LEVEL: Maximum debug log level, default5.
Press F to pay respects.
Ctrl+X Ctrl+X runs experimental inline mode. It fixes the command in place
without executing it:
gitcommit+C-XC-X→git commitz payrespe+C-XC-X→cd /home/iff/Code/pay-respects
In fish and Nushell, pressing e in the suggestion list puts the selected fix
back into the prompt instead of running it. Edit it with the shell's own
key bindings and press Enter when ready:
gitcommit+f+e→git commitat the prompt
On other shells, or with [ui] prompt_edit = false, e opens the selected fix
in $VISUAL/$EDITOR and runs it when saved.
Integrations with other tools
- tmux, GNU Screen, Zellij, WezTerm, kitty:
- Read the command log from the session. This avoids rerunning the command to get its error message. Set
LANG=Cso the log matches reliably.- The prompt must show a prefix before the command. The generated shell config sets this up.
- zoxide: Uses its database to navigate directories.
Environment variable configuration
_PR_LIB: Module directories, separated likePATH. If unset, pay-respects usesPATHand the compile-time value._PR_PACKAGE_MANAGER: Package manager to use instead of guessing from an alphabetical list. Set it to an empty value to disable package search.
_DEF_PR_PACKAGE_MANAGER: Compile-time value
_PR_MODEselects the run mode:
noconfirm: Execute a suggestion without confirmationinline: Print the best fix without executing itecho: Print suggestions tostdoutwithout executing themcnf: Internal mode for the command-not-found hookExample with
noconfirm:# new versions alias ff="__pr_main noconfirm" # old versions function ff() { ( export _PR_MODE="noconfirm" f ) }Other options:
_PR_NO_CONFIG: Skip configuration files_PR_NO_DESPERATE: Disable slow fallback checks that sometimes give a better result_PR_PREFIX: Prompt prefix before the command. Needed to read logs from multiplexers.- Disable integrations:
_PR_NO_ZOXIDE_PR_NO_MULTIPLEXER: Same as setting all of these:
_PR_NO_TMUX_PR_NO_SCREEN_PR_NO_ZELLIJ_PR_NO_WEZTERM_PR_NO_KITTY
Installing
Install from your package manager if available:
Instructions for package managers
OS / Distribution Repository Instructions Arch Linux AUR paru -S pay-respects(-bin)Arch Linux (ARM) Arch Linux CN sudo pacman -S pay-respectsMacOS / Any timescam brew install timescam/homebrew-tap/pay-respectsNixOS / Any nixpkgs nix-env -iA nixos.pay-respects
Pre-built binaries are on GitHub releases. Install scripts are also available. On Unix:
curl -sSfL https://raw.githubusercontent.com/iffse/pay-respects/main/install.sh | sh
On Windows, with PowerShell:
irm https://raw.githubusercontent.com/iffse/pay-respects/main/install.ps1 | iex
Cargo / Compile from source (any OS and architecture supported by Rust)
You need Cargo for this.
Install the core package and any modules you want from crates.io:
cargo install pay-respects cargo install pay-respects-module-runtime-rules cargo install pay-respects-module-request-ai
A git clone is better if you want custom compile-time rules:
git clone --depth 1 https://github.com/iffse/pay-respects cd pay-respects cargo install --path core cargo install --path module-runtime-rules cargo install --path module-request-ai
Configuration
See configuration.
Rules & Modules
AI Integration
Disclaimer: AI suggestions can be wrong. Check them before you accept one.
AI suggestions are opt-in. When request-ai is installed and no API key is
configured, the module asks whether to use the built-in key. You can remember
the answer in the configuration file:
[module.request-ai]
enabled = true
Set enabled = false, or set _PR_AI_DISABLE to any value, to turn AI
suggestions off:
export _PR_AI_DISABLE=1
A built-in API key ships with the source. Some distributions remove it. The service is free while I can cover the cost. It may stop when rate limits hit.
The proxy does not track or store anything. If the service is useful to you, consider a donation:
AI usage and API configuration
Contributing
The current rule format covers most cases. More rules are welcome.
See the roadmap for open work.
The project is mirrored on several sites. Pick the one you prefer:
Licenses
- Binaries: AGPL-3.0
- Core and modules
- Libraries: MPL-2.0
- Parser, rule engine, utils, and select
Benchmarks
Run make bench with hyperfine to reproduce these numbers. The results below
come from my machine (AMD Ryzen 5 5600X, DDR4 2400 MHz, HDD 7200 RPM with Btrfs
compression, glibc build). Yours will differ.
| Case | Results |
|---|---|
| Initialization | 493.7 µs ± 38.1 µs |
| Privilege | 655.0 µs ± 100.4 µs |
| Typo: Command | 5.1 ms ± 0.2 ms |
| Typo: File path | 3.6 ms ± 0.4 ms |
| RegEx: Command | 3.3 ms ± 0.1 ms |
| RegEx: Options | 3.3 ms ± 0.2 ms |
| RegEx: Error | 3.3 ms ± 0.1 ms |
| Desperate: Fuzzy recovery | 703.5 µs ± 65.9 µs |
| Desperate: File look up | 3.4 ms ± 0.2 ms |
Caveats:
- Integrations are off: In real use, a delay can come from a tool such as
zoxide. It takes about 50 ms on its own. - Binaries are optimized for size, not speed. They use regex-lite instead of regex because it is smaller, though slower. A smaller binary loads faster, especially on a cold run.
Flowchart
How it works:
関連プロジェクトを探す
読み込み中…