From b63ce26853c1f6e1c62bfe7be5778a453a89836a Mon Sep 17 00:00:00 2001 From: nvbn Date: Wed, 20 May 2015 02:50:08 +0300 Subject: [PATCH] Reorganize list of rules in readme --- README.md | 25 +++++++++++++++---------- thefuck/rules/grep_recursive.py | 2 +- thefuck/rules/ls_lah.py | 3 --- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f2406b19..a1a176ce 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/thefuck/rules/grep_recursive.py b/thefuck/rules/grep_recursive.py index ed0b6fdb..f2876fe1 100644 --- a/thefuck/rules/grep_recursive.py +++ b/thefuck/rules/grep_recursive.py @@ -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()) diff --git a/thefuck/rules/ls_lah.py b/thefuck/rules/ls_lah.py index 50fe9f5e..7eba5bda 100644 --- a/thefuck/rules/ls_lah.py +++ b/thefuck/rules/ls_lah.py @@ -1,6 +1,3 @@ -enabled_by_default = False - - def match(command, settings): return 'ls' in command.script and not ('ls -' in command.script)