Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
878 B
Go
45 lines
878 B
Go
package prompt
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/fatih/color"
|
|
"github.com/isacikgoz/prompt/term"
|
|
)
|
|
|
|
type Selection struct {
|
|
prompt *Prompt
|
|
result string
|
|
}
|
|
|
|
func NewSelection(question string, answers []string, footnote string, maxLineSize int) (*Selection, error) {
|
|
list, err := NewList(answers, maxLineSize)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
sel := &Selection{}
|
|
|
|
selFn := func(item interface{}) error {
|
|
sel.result = fmt.Sprintf("%s", item)
|
|
sel.prompt.Stop()
|
|
return nil
|
|
}
|
|
|
|
infoFn := func(item interface{}) [][]term.Cell {
|
|
i := term.Cprint(footnote, color.FgRed)
|
|
return [][]term.Cell{i}
|
|
}
|
|
|
|
sel.prompt = Create(question, &Options{LineSize: maxLineSize}, list,
|
|
WithSelectionHandler(selFn), WithInformation(infoFn))
|
|
|
|
return sel, nil
|
|
}
|
|
|
|
func (s *Selection) Run() (string, error) {
|
|
err := s.prompt.Run(context.Background())
|
|
return s.result, err
|
|
}
|