1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00

#102 Update readme

This commit is contained in:
nvbn 2015-05-01 04:43:55 +02:00
parent 5eeb9d704c
commit 9a43ba6e24

View File

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