@@ -83,10 +83,9 @@ func (c *CertDomainTachCompletion) CompletionFunc(cmd *cobra.Command, args []str
8383 if len (args ) == 0 {
8484 certCompletion := CertCompletion {AppID : c .AppID , ConfigFile : c .ConfigFile }
8585 return certCompletion .CompletionFunc (cmd , args , toComplete )
86- } else {
87- domainCompletion := DomainCompletion {AppID : c .AppID , ArgsLen : 1 , ConfigFile : c .ConfigFile }
88- return domainCompletion .CompletionFunc (cmd , args , toComplete )
8986 }
87+ domainCompletion := DomainCompletion {AppID : c .AppID , ArgsLen : 1 , ConfigFile : c .ConfigFile }
88+ return domainCompletion .CompletionFunc (cmd , args , toComplete )
9089}
9190
9291type ConfigPtsGroupArgsCompletion struct {
@@ -98,20 +97,19 @@ func (c *ConfigPtsGroupArgsCompletion) CompletionFunc(cmd *cobra.Command, args [
9897 if len (args ) == 0 {
9998 ptsCompletion := PtsCompletion {AppID : c .AppID , ConfigFile : c .ConfigFile }
10099 return ptsCompletion .CompletionFunc (cmd , args , toComplete )
101- } else {
102- groups := args [1 :]
103- if appID , s , err := utils .LoadAppSettings (* c .ConfigFile , * c .AppID ); err == nil {
104- if config , err := config .List (s .Client , appID , - 1 ); err == nil {
105- var results []string
106- for _ , value := range config .Values {
107- if value .Group != "" && strings .HasPrefix (value .Group , toComplete ) {
108- if ! slices .Contains (groups , value .Group ) && ! slices .Contains (results , value .Group ) {
109- results = append (results , value .Group )
110- }
100+ }
101+ groups := args [1 :]
102+ if appID , s , err := utils .LoadAppSettings (* c .ConfigFile , * c .AppID ); err == nil {
103+ if config , err := config .List (s .Client , appID , - 1 ); err == nil {
104+ var results []string
105+ for _ , value := range config .Values {
106+ if value .Group != "" && strings .HasPrefix (value .Group , toComplete ) {
107+ if ! slices .Contains (groups , value .Group ) && ! slices .Contains (results , value .Group ) {
108+ results = append (results , value .Group )
111109 }
112110 }
113- return results , cobra .ShellCompDirectiveNoFileComp
114111 }
112+ return results , cobra .ShellCompDirectiveNoFileComp
115113 }
116114 }
117115 return nil , cobra .ShellCompDirectiveNoFileComp
@@ -123,8 +121,7 @@ type ConfigGroupCompletion struct {
123121 ArgsLen int
124122}
125123
126- func (c * ConfigGroupCompletion ) CompletionFunc (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
127-
124+ func (c * ConfigGroupCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
128125 if appID , s , err := utils .LoadAppSettings (* c .ConfigFile , * c .AppID ); err == nil && (c .ArgsLen < 0 || len (args ) == c .ArgsLen ) {
129126 if config , err := config .List (s .Client , appID , - 1 ); err == nil {
130127 var results []string
@@ -253,10 +250,9 @@ func (c *HealthChecksCompletion) CompletionFunc(cmd *cobra.Command, args []strin
253250 if len (args ) == 0 {
254251 healthTypeCompletion := HealthTypeCompletion {ArgsLen : 0 , ConfigFile : c .ConfigFile }
255252 return healthTypeCompletion .CompletionFunc (cmd , args , toComplete )
256- } else {
257- probeTypeCompletion := ProbeTypeCompletion {ArgsLen : 1 , ConfigFile : c .ConfigFile }
258- return probeTypeCompletion .CompletionFunc (cmd , args , toComplete )
259253 }
254+ probeTypeCompletion := ProbeTypeCompletion {ArgsLen : 1 , ConfigFile : c .ConfigFile }
255+ return probeTypeCompletion .CompletionFunc (cmd , args , toComplete )
260256}
261257
262258type ServiceProtocolCompletion struct {
@@ -555,7 +551,7 @@ type ResourcePlanCompletion struct {
555551 ConfigFile * string
556552}
557553
558- func (c * ResourcePlanCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
554+ func (c * ResourcePlanCompletion ) CompletionFunc (_ * cobra.Command , args []string , _ string ) ([]string , cobra.ShellCompDirective ) {
559555 if s , err := settings .Load (* c .ConfigFile ); err == nil && (c .ArgsLen < 0 || len (args ) == c .ArgsLen ) {
560556 var results []string
561557 if services , _ , err := resources .Plans (s .Client , c .Service , - 1 ); err == nil {
@@ -735,15 +731,14 @@ func (c *TagCompletion) CompletionFunc(_ *cobra.Command, args []string, toComple
735731 return nil , cobra .ShellCompDirectiveNoFileComp
736732}
737733
738- type TlsActionCompletion struct {
734+ type TLSActionCompletion struct {
739735 ArgsLen int
740736 ConfigFile * string
741737}
742738
743- func (c * TlsActionCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
739+ func (c * TLSActionCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
744740 actions := []string {"enable" , "disable" }
745741 if c .ArgsLen < 0 || len (args ) == c .ArgsLen {
746-
747742 var results []string
748743 for _ , action := range actions {
749744 if strings .HasPrefix (action , toComplete ) {
0 commit comments