pixi
pixi copied to clipboard
Validate task args
Problem description
per https://github.com/prefix-dev/pixi/issues/3533#issuecomment-2783696643:
I would love if args also had a richer model to help projects write maintainable, self-documenting tasks:
[tasks.foo-one--]
cmd = "echo built {{ bar }} > bar/{{ bar }}.txt"
args = [
{ "arg" = "bar", default = "baz", description = "the foo to bar", enum=["baz", "boo"], regex="(baz|boo)" }
]
These would be lovely to see in a pixi task help foo, and give good feedback:
$> pixi r foo-one-- --bar poo
`foo-one--` argument `--bar` (the foo to bar) to was `poo`, but should be:
- one of `baz`, `boo`
- match the pattern `(baz|boo)`
Use `pixi task help foo-one--` to learn more.
The original proposal also contained the enum key, and I am open to adding that.
Regarding regex, I'd like to think a bit more if regex or glob makes more sense here, so let's keep that out of that issue for now.
Im wondering if we could reuse clap to do some of this processing? 🤔