mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 04:21:14 +00:00
#102 Update readme
This commit is contained in:
parent
5eeb9d704c
commit
9a43ba6e24
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user