Skip to content

Commit f8207b2

Browse files
committed
Update README
1 parent 988242b commit f8207b2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,29 @@ def example():
147147
print(config["tool.spin"])
148148
```
149149

150+
### Argument overrides
151+
152+
Default arguments can be overridden for any command.
153+
The custom command above, e.g., has the following signature:
154+
155+
```python
156+
@click.command()
157+
@click.option("-f", "--flag")
158+
@click.option("-t", "--test", default="not set")
159+
def example(flag, test, default_kwd=None):
160+
"""🧪 Example custom command.
161+
...
162+
"""
163+
```
164+
165+
Use the `[tool.spin.kwargs]` section to override default values for
166+
both click options and keywords:
167+
168+
```toml
169+
[tool.spin.kwargs]
170+
".spin/cmds.py:example" = {"test" = "default override", "default_kwd" = 3}
171+
```
172+
150173
### Advanced: adding arguments to built-in commands
151174

152175
Instead of rewriting a command from scratch, a project may want to add a flag to a built-in `spin` command, or perhaps do some pre- or post-processing.

0 commit comments

Comments
 (0)