mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +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
|
||||
|
||||
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
|
||||
in `~/.thefuck/rules`. The rule should contain two functions:
|
||||
```python
|
||||
match(command: Command, settings: Settings) -> bool
|
||||
get_new_command(command: Command, settings: Settings) -> str
|
||||
```
|
||||
|
||||
Also the rule can contain an optional function
|
||||
`side_effect(command: Command, settings: Settings) -> None` and an
|
||||
optional boolean `enabled_by_default`.
|
||||
|
||||
`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`:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user