File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66 "github.com/carapace-sh/carapace"
77 "github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
8+ "github.com/carapace-sh/carapace-bridge/pkg/actions/choice"
89 "github.com/carapace-sh/carapace-bridge/pkg/choices"
910 "github.com/spf13/cobra"
1011)
@@ -53,15 +54,7 @@ func init() {
5354 carapace .Gen (choiceCmd ).PositionalAnyCompletion (
5455 carapace .ActionCallback (func (c carapace.Context ) carapace.Action {
5556 if choiceCmd .Flag ("delete" ).Changed {
56- list , err := choices .List (true )
57- if err != nil {
58- return carapace .ActionMessage (err .Error ())
59- }
60- vals := make ([]string , 0 )
61- for _ , choice := range list {
62- vals = append (vals , choice .Name , choice .Format ())
63- }
64- return carapace .ActionValuesDescribed (vals ... )
57+ return choice .ActionChoices ()
6558 }
6659
6760 return carapace .ActionMultiPartsN ("/" , 2 , func (c carapace.Context ) carapace.Action {
Original file line number Diff line number Diff line change @@ -19,6 +19,6 @@ func ActionChoices() carapace.Action {
1919 for _ , choice := range list {
2020 vals = append (vals , choice .Name , choice .Format ())
2121 }
22- return carapace .ActionValues (vals ... )
23- })
22+ return carapace .ActionValuesDescribed (vals ... )
23+ }). Tag ( "choices" )
2424}
You can’t perform that action at this time.
0 commit comments