From 9a43ba6e24c6515ea5d53d04b75d28021cc6d3d7 Mon Sep 17 00:00:00 2001 From: nvbn Date: Fri, 1 May 2015 04:43:55 +0200 Subject: [PATCH] #102 Update readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 9a13e72..a25d601 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,9 @@ For adding your own rule you should create `your-rule-name.py` in `~/.thefuck/rules`. Rule should contain two functions: `match(command: Command, settings: Settings) -> bool` and `get_new_command(command: Command, settings: Settings) -> str`. +Also the rule can contain optional function +`side_effect(command: Command, settings: Settings) -> None` and +optional boolean `enabled_by_default` `Command` has three attributes: `script`, `stdout` and `stderr`. @@ -177,6 +180,12 @@ def match(command, settings): def get_new_command(command, settings): return 'sudo {}'.format(command.script) + +# Optional: +enabled_by_default = True + +def side_effect(command, settings): + subprocess.call('chmod 777 .', shell=True) ``` [More examples of rules](https://github.com/nvbn/thefuck/tree/master/thefuck/rules),