Skip to content

Commit

Permalink
👔 up: add new multi choices for input params
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Dec 22, 2022
1 parent 81efec5 commit 80dd56a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions interact/cparam/choices.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type ChoiceParam struct {
InputParam
// Choices for select
Choices []string
selected []string
selected string
}

// NewChoiceParam instance
Expand All @@ -31,8 +31,8 @@ func (p *ChoiceParam) WithChoices(Choices []string) *ChoiceParam {
}

// Selected values get
func (p *ChoiceParam) Selected() []string {
return p.val.Strings()
func (p *ChoiceParam) Selected() string {
return p.val.String()
}

// Set value
Expand All @@ -41,7 +41,7 @@ func (p *ChoiceParam) Set(v string) error {
return err
}

p.selected = append(p.selected, v)
p.selected = v
p.val.Set(p.selected)
return nil
}
Expand All @@ -53,7 +53,7 @@ func (p *ChoiceParam) Run() (err error) {
}

s := interact.NewSelect(p.Desc(), p.Choices)
s.EnableMulti()
// s.EnableMulti()

sr := s.Run()
p.val.Set(sr.Val())
Expand Down
2 changes: 1 addition & 1 deletion show/table/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ func TestNewTable(t *testing.T) {
// TODO ...
})

tb.Println()
// tb.Println()
}

0 comments on commit 80dd56a

Please sign in to comment.