project ❯ gti status
zsh: command not found: gti
project ❯ welp
welp git status ↵ run · esc nah
Why welp
thefuck is one of the most-loved command-line tools ever made. It has also had no release since January 2022, and it breaks on Python 3.12 and newer (No module named 'imp'). welp keeps what made it great and quietly fixes the rest:
- No Python. One small binary that starts instantly, on any Python version or none.
- Safe. welp never runs destructive or interactive commands (
rm,mv,dd, editors,ssh, ...) a second time just to read their output. Rules that need to know more look at your files instead. - Moves your setup for you.
welp migrateswitches your shell config, keeps your alias (yes,fuckstill works) and imports your settings. - Same rule names. Your thefuck
exclude_ruleskeep working. - Workplace-friendly name. Use whatever alias you like.
- A little personality. Lowercase, low-key, and the occasional "happens to the best of us." Set
quiet = trueif you'd rather it just did its job.
Install
Homebrew and prebuilt binaries are coming.
Set up
Add one line to your shell config, then open a new terminal:
| Shell | Line | File |
|---|---|---|
| zsh | eval "$(welp init zsh)" |
~/.zshrc |
| bash | eval "$(welp init bash)" |
~/.bashrc |
| fish | welp init fish | source |
~/.config/fish/config.fish |
Prefer another word? Add --alias, for example eval "$(welp init zsh --alias oops)".
Coming from thefuck
It comments out the thefuck lines in your shell config (with a backup next to each file), adds welp in their place with your alias, and turns ~/.config/thefuck/settings.py into ~/.config/welp/config.toml.
Rules
| Rule | What it fixes |
|---|---|
no_command |
A mistyped program name: gti → git |
git_not_command |
A mistyped git subcommand: git comit → git commit |
git_push |
Sets the upstream when a new branch has none |
git_pull |
Sets the tracking branch, then pulls |
git_checkout |
Creates the branch when it does not exist yet |
git_branch_delete |
-d → -D for a branch that is not merged |
git_commit_add |
Stages changed files when a commit has nothing staged |
did_you_mean |
Uses the fix a tool suggests: cargo, npm, pip, brew, gh and more |
sudo |
Runs the command again with sudo after "permission denied" |
chmod_x |
Makes a script executable before running it |
apt_get |
Installs a missing program the system names, then runs it |
cd_mkdir |
Creates the folder you tried to cd into |
cd_parent |
cd.. → cd .. |
mkdir_p |
Adds -p when parent folders are missing |
cp_omitting_directory |
Adds -r to copy a folder |
rm_dir |
Adds -r to remove a folder |
grep_recursive |
Adds -r to search a folder |
touch |
Creates missing folders, then the file |
sl_ls |
sl → ls |
welp rules lists them. More of thefuck's 170 rules are being ported. Pull requests are welcome.
Settings
~/.config/welp/config.toml (or $XDG_CONFIG_HOME/welp/config.toml):
= true # false runs the first fix straight away
= 3 # seconds to wait when reading a command's output
= 15
= ["lein", "react-native", "gradle", "./gradlew", "vagrant"]
= ["rm", "mv", "dd", "vim", "ssh"] # never run these twice (the full default list is longer)
= []
= false # true keeps the occasional one-liners to itself
Set NO_COLOR to drop the colours; welp keeps the words.
Adding a rule
A rule is a name, a check and a fix, in src/rules/. Each comes with a test that feeds it a command and the output a real tool printed:
Rule ,
Run cargo test before opening a pull request.
The demo above is a real session: demo/record.sh sets up a throwaway repo and types the commands into zsh.
Support
If welp saves you some typing, you can buy me a coffee or come hang out on Discord.
Credits
welp's rules are ports of thefuck's, by Vladimir Iakovlev and its contributors (MIT). welp is not affiliated with thefuck.
License
MIT