From 80dd56ad65f406f9392cb467d9631e542246d4fa Mon Sep 17 00:00:00 2001 From: Inhere Date: Thu, 22 Dec 2022 10:40:48 +0800 Subject: [PATCH] :necktie: up: add new multi choices for input params --- interact/cparam/choices.go | 10 +++++----- show/table/table_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interact/cparam/choices.go b/interact/cparam/choices.go index 38c999a..e28a1c5 100644 --- a/interact/cparam/choices.go +++ b/interact/cparam/choices.go @@ -10,7 +10,7 @@ type ChoiceParam struct { InputParam // Choices for select Choices []string - selected []string + selected string } // NewChoiceParam instance @@ -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 @@ -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 } @@ -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()) diff --git a/show/table/table_test.go b/show/table/table_test.go index e650c18..d60b5c7 100644 --- a/show/table/table_test.go +++ b/show/table/table_test.go @@ -12,5 +12,5 @@ func TestNewTable(t *testing.T) { // TODO ... }) - tb.Println() + // tb.Println() }