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),