| 622 | } |
| 623 | |
| 624 | func 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. |