mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
Have the README look better
This commit is contained in:
parent
33b1536c28
commit
e572cab1f3
15
README.md
15
README.md
@ -200,16 +200,19 @@ Bundled, but not enabled by default:
|
|||||||
## Creating your own rules
|
## Creating your own rules
|
||||||
|
|
||||||
For adding your own rule you should create `your-rule-name.py`
|
For adding your own rule you should create `your-rule-name.py`
|
||||||
in `~/.thefuck/rules`. Rule should contain two functions:
|
in `~/.thefuck/rules`. The rule should contain two functions:
|
||||||
`match(command: Command, settings: Settings) -> bool`
|
```python
|
||||||
and `get_new_command(command: Command, settings: Settings) -> str`.
|
match(command: Command, settings: Settings) -> bool
|
||||||
Also the rule can contain optional function
|
get_new_command(command: Command, settings: Settings) -> str
|
||||||
`side_effect(command: Command, settings: Settings) -> None` and
|
```
|
||||||
|
|
||||||
|
Also the rule can contain an optional function
|
||||||
|
`side_effect(command: Command, settings: Settings) -> None` and an
|
||||||
optional boolean `enabled_by_default`.
|
optional boolean `enabled_by_default`.
|
||||||
|
|
||||||
`Command` has three attributes: `script`, `stdout` and `stderr`.
|
`Command` has three attributes: `script`, `stdout` and `stderr`.
|
||||||
|
|
||||||
`Settings` is a special object filled with `~/.thefuck/settings.py` and values from env, [more](#settings).
|
`Settings` is a special object filled with `~/.thefuck/settings.py` and values from env ([see more below](#settings)).
|
||||||
|
|
||||||
Simple example of the rule for running script with `sudo`:
|
Simple example of the rule for running script with `sudo`:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user