jdx / usage

A specification for CLIs
https://usage.jdx.dev
MIT License
157 stars 6 forks source link

Extend Spec to include choices for Args #138

Closed miguelmig closed 1 month ago

miguelmig commented 1 month ago

Clap has the concept of possible values when an argument is a Enum which can be extracted using arg.get_possible_values.

A new option for the arg element to include such choices could be implemented for tools like Fig to suggest only the valid options for such argument,

jdx commented 1 month ago

isn't that the "choices" property on args? https://usage.jdx.dev/spec/reference/arg#arg

miguelmig commented 1 month ago

Oh okay so it's already a property, it's just that usage doesn't export it then. When I generate mise.usage.kdl through mise usage it doesn't contain the choices from what I've seen. Currently unclear if it's on the mise side or usage side then

jdx commented 1 month ago

https://github.com/jdx/mise/blob/612bbd0374bed208752cda8674ad192b5886fde9/mise.usage.kdl#L185

miguelmig commented 1 month ago

Interesting, when I generated it, it didn't include it as you can see in the screenshot

image image
jdx commented 1 month ago

make sure usage and mise are up-to-date

miguelmig commented 1 month ago

Yep that was it, somehow my forks were not sync'ed. Thanks!