1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-20 20:09:07 +00:00

Reorganize list of rules in readme

This commit is contained in:
nvbn 2015-05-20 02:50:08 +03:00
parent ce6855fd97
commit b63ce26853
3 changed files with 16 additions and 14 deletions

View File

@ -145,41 +145,46 @@ sudo pip install thefuck --upgrade
The Fuck tries to match a rule for the previous command, creates a new command
using the matched rule and runs it. Rules enabled by default are as follows:
* `brew_unknown_command` – fixes wrong brew commands, for example `brew docto/brew doctor`;
* `cpp11` – add missing `-std=c++11` to `g++` or `clang++`;
* `cd_parent` – changes `cd..` to `cd ..`;
* `cd_correction` – spellchecks and correct failed cd commands;
* `cd_mkdir` – creates directories before cd'ing into them;
* `cd_parent` – changes `cd..` to `cd ..`;
* `composer_not_command` – fixes composer command name;
* `cp_omitting_directory` – adds `-a` when you `cp` directory;
* `cpp11` – add missing `-std=c++11` to `g++` or `clang++`;
* `dry` – fix repetitions like "git git push";
* `fix_alt_space` – replaces Alt+Space with Space character;
* `git_add` – fix *"Did you forget to 'git add'?"*;
* `git_checkout` – creates the branch before checking-out;
* `git_no_command` – fixes wrong git commands like `git brnch`;
* `git_push` – adds `--set-upstream origin $branch` to previous failed `git push`;
* `git_pull` – sets upstream before executing previous `git pull`;
* `git_push` – adds `--set-upstream origin $branch` to previous failed `git push`;
* `git_stash` – stashes you local modifications before rebasing or switching branch;
* `grep_recursive` – adds `-r` when you trying to grep directory;
* `has_exists_script` – prepends `./` when script/binary exists;
* `lein_not_task` – fixes wrong `lein` tasks like `lein rpl`;
* `ls_lah` – adds -lah to ls;
* `man_no_space` – fixes man commands without spaces, for example `mandiff`;
* `mkdir_p` – adds `-p` when you trying to create directory without parent;
* `no_command` – fixes wrong console commands, for example `vom/vim`;
* `no_such_file` – creates missing directories with `mv` and `cp` commands;
* `man_no_space` – fixes man commands without spaces, for example `mandiff`;
* `pacman` – installs app with `pacman` or `yaourt` if it is not installed;
* `pip_unknown_command` – fixes wrong pip commands, for example `pip instatl/pip install`;
* `python_command` – prepends `python` when you trying to run not executable/without `./` python script;
* `sl_ls` – changes `sl` to `ls`;
* `rm_dir` – adds `-rf` when you trying to remove directory;
* `sl_ls` – changes `sl` to `ls`;
* `ssh_known_hosts` – removes host from `known_hosts` on warning;
* `sudo` – prepends `sudo` to previous command if it failed because of permissions;
* `switch_layout` – switches command from your local layout to en;
* `whois` – fixes `whois` command;
* `whois` – fixes `whois` command.
Enabled by default only on specific platforms:
* `apt_get` – installs app from apt if it not installed;
* `brew_install` – fixes formula name for `brew install`;
* `composer_not_command` – fixes composer command name.
* `brew_unknown_command` – fixes wrong brew commands, for example `brew docto/brew doctor`;
* `pacman` – installs app with `pacman` or `yaourt` if it is not installed.
Bundled, but not enabled by default:
* `ls_lah` – adds -lah to ls;
* `rm_root` – adds `--no-preserve-root` to `rm -rf /` command.
## Creating your own rules

View File

@ -1,5 +1,5 @@
def match(command, settings):
return (command.script.startswith('grep')
return (command.script.startswith('grep')
and 'is a directory' in command.stderr.lower())

View File

@ -1,6 +1,3 @@
enabled_by_default = False
def match(command, settings):
return 'ls' in command.script and not ('ls -' in command.script)