- Notifications
You must be signed in to change notification settings - Fork923
Description
Problem
cliui.Multiselect
currently does not allow users to input custom options if zero choices are provided.
Use case
As a template author, I want to allow my users to allow setting arbitrary environment variables inside their workspace container.
I provide a parameter similar to the below:
data "coder_parameter" "env_vars" { name = "env_vars" display_name = "Additional environment variables" type = "list(string)" default = jsonencode([]) description = "key=value pairs to set in container" mutable = true}
What I want
My users should then be able to specify additional environment variables when creating workspaces via both UI and CLI:
Additional environment variables key=value pairs to set in workspace environment> foo=bar> baz=zap? [Type to add an option, or press Enter to finish]Planning workspace...
What I get
Users can specify additional environment variables via UI, but CLI does not work:
Additional environment variables key=value pairs to set in workspace environment <-- does not even prompt the user to add more optionsPlanning workspace...
The only workaround for CLI is to specify parameters via--rich-parameter-file
.
Proposed Solution
cliui.MultiSelect
should always allow users to specify another option.
For example, when runningcoder exp prompt-example multi-select
:
? Select some things: [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]> [x] Code [ ] Chair [ ] Whale [ ] Diamond [ ] Carrot ... Other# Input: 🔽🔽🔽🔽🔽? Select some things: [Use arrows to move, space to select, <right> to all, <left> to none, type to filter] [x] Code [ ] Chair [ ] Whale [ ] Diamond [ ] Carrot> ... Other# Input: ⏎? Type what you want: [Enter to submit]: > # Input: potato⏎? Select some things: [Use arrows to move, space to select, <right> to all, <left> to none, type to filter] [x] Code [ ] Chair [ ] Whale [ ] Diamond [ ] Carrot [x] potato> ... Other