mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(cli): support description in create and presets list CLI commands (#19079)
## Description This PR improves the `coder templates presets` and `coder create` CLI commands to include preset descriptions. ## Changes * Added a `description` column to the `coder templates presets list` CLI command. * Fixed the `-o json` output for `coder templates presets list` to correctly include and format data. * Updated the `coder create` CLI command to display the preset's description in the selection menu. Follow-up from: * https://github.com/coder/coder/pull/18910 * https://github.com/coder/coder/pull/18912 * https://github.com/coder/coder/pull/18977
This commit is contained in:
+6
-1
@@ -472,7 +472,12 @@ func promptPresetSelection(inv *serpent.Invocation, presets []codersdk.Preset) (
|
||||
var presetOptions []string
|
||||
|
||||
for _, preset := range presets {
|
||||
option := preset.Name
|
||||
var option string
|
||||
if preset.Description == "" {
|
||||
option = preset.Name
|
||||
} else {
|
||||
option = fmt.Sprintf("%s: %s", preset.Name, preset.Description)
|
||||
}
|
||||
presetOptions = append(presetOptions, option)
|
||||
presetMap[option] = &preset
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user