Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: implement rich multi-selector#19201

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 6 commits intomainfrom17402-fix-warn
Aug 6, 2025
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Fixes
  • Loading branch information
@mtojek
mtojek committedAug 6, 2025
commite71c7f389da6e1695c461b871e96886a586b10df
26 changes: 21 additions & 5 deletionscli/cliui/select.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -311,15 +311,30 @@
opts := make([]string, len(richOptions.Options))
var defaultOpts []string

for i, option:=range richOptions.Options {
asLine:=func(option codersdk.TemplateVersionParameterOption) string {
line := option.Name
if len(option.Description) > 0 {
line += ": " + option.Description
}
opts[i] = line
return line
}

var predefinedOpts []string
for i, option := range richOptions.Options {
opts[i] = asLine(option) // Some options may have description defined.

// Check if option is selected by default
if slices.Contains(richOptions.Defaults, option.Value) {
defaultOpts = append(defaultOpts, line)
defaultOpts = append(defaultOpts, opts[i])
predefinedOpts = append(predefinedOpts, option.Value)
}
}

// Check if "defaults" contains extra/custom options, user could select them.
for _, def := range richOptions.Defaults {
if !slices.Contains(predefinedOpts, def) {
opts = append(opts, def)

Check failure on line 336 in cli/cliui/select.go

View workflow job for this annotation

GitHub Actions/ lint

append to slice `opts` with non-zero initialized length (makezero)
defaultOpts = append(defaultOpts, def)
}
}

Expand All@@ -333,11 +348,12 @@
return nil, err
}

// Check selected option, convert descriptions (line) to values
var results []string
for _, sel := range selected {
custom := true
for i, option := rangeopts {
if option == sel {
for i, option := rangerichOptions.Options {
ifasLine(option) == sel {
results = append(results, richOptions.Options[i].Value)
custom = false
break
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp