Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choices from command #232

Open
richard-kramer-work opened this issue Feb 3, 2025 · 0 comments
Open

choices from command #232

richard-kramer-work opened this issue Feb 3, 2025 · 0 comments

Comments

@richard-kramer-work
Copy link

(comming from using usage in mise tasks)

It would be nice to define possible choices values similar to the complete specification complete "foo" run="my_command".

Currently, I have the option to manually define all possible values in choices and have them show up in the help/docs. Or have my autocomplete options generated by an external command, but not show the options in any docs.

But sometimes my possible choices are options belonging to an external tool (e.g., services in a compose config) and I don't want to manually write them into my spec.

Example:

Manually defined choices

#!/usr/bin/env bash
# .mise/tasks/build
#MISE description="Build the docker images."
#
#USAGE arg "<services>..." help="The services to build." default="app database" {
#USAGE   choices "app" "database"
#USAGE }

#
mise run build --help
# =>
# Usage: build [services]...

# Arguments:
#   [services]...
#     The services to build.
#     [possible values: app, database]
mise run build <tab><tab>
# =>
# app database

No choices, but with autocomplete

#!/usr/bin/env bash
# .mise/tasks/build
#MISE description="Build the docker images."
#
#USAGE arg "<services>..." help="The services to build."
#USAGE complete "services" run="docker compose config | yq '.services | keys[]'"

#
mise run build --help
# =>
# Usage: build [services]...

# Arguments:
#   [services]...
#     The services to build.
mise run build <tab><tab>
# =>
# app database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant