MCPcopy Index your code
hub / github.com/abiosoft/ishell / buildOptionsStrings

Function buildOptionsStrings

ishell.go:624–648  ·  view source on GitHub ↗
(options []string, selected []int, index int)

Source from the content-addressed store, hash-verified

622}
623
624func buildOptionsStrings(options []string, selected []int, index int) []string {
625 var strs []string
626 symbol := strMultiChoice
627 if runtime.GOOS == "windows" {
628 symbol = strMultiChoiceWin
629 }
630 for i, opt := range options {
631 mark := strMultiChoiceOpen
632 if selected == nil {
633 mark = strMultiChoiceSpacer
634 }
635 for _, s := range selected {
636 if s == i {
637 mark = strMultiChoiceSelect
638 }
639 }
640 if i == index {
641 cyan := color.New(color.FgCyan).Add(color.Bold).SprintFunc()
642 strs = append(strs, cyan(symbol+mark+opt))
643 } else {
644 strs = append(strs, strings.Repeat(" ", utf8.RuneCountInString(symbol))+mark+opt)
645 }
646 }
647 return strs
648}
649
650// IgnoreCase specifies whether commands should not be case sensitive.
651// Defaults to false i.e. commands are case sensitive.

Callers 1

multiChoiceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected