choices from command
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start with the existing choices and complete specifications described in the issue and compare their help output and tab-completion behavior. Define how command-generated choices should connect these two behaviors; done means the example values appear in both possible-values help and completion output.
Written by the indexing model from the issue text.
Description
(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
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 59
- Avg merge
- 5h 58m
- Merged PRs (30d)
- 362
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jdx/usage
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100