Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Mar 23, 2024
1 parent 8f5bdb0 commit b5a8ff5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,29 @@ def example():
print(config["tool.spin"])
```

### Argument overrides

Default arguments can be overridden for any command.
The custom command above, e.g., has the following signature:

```python
@click.command()
@click.option("-f", "--flag")
@click.option("-t", "--test", default="not set")
def example(flag, test, default_kwd=None):
"""🧪 Example custom command.
...
"""
```

Use the `[tool.spin.kwargs]` section to override default values for
both click options and keywords:

```toml
[tool.spin.kwargs]
".spin/cmds.py:example" = {"test" = "default override", "default_kwd" = 3}
```

### Advanced: adding arguments to built-in commands

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.
Expand Down

0 comments on commit b5a8ff5

Please sign in to comment.