@@ -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,7 +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 ) {
124+ func (c * ConfigGroupCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
127125
128126 if appID , s , err := utils .LoadAppSettings (* c .ConfigFile , * c .AppID ); err == nil && (c .ArgsLen < 0 || len (args ) == c .ArgsLen ) {
129127 if config , err := config .List (s .Client , appID , - 1 ); err == nil {
@@ -253,10 +251,9 @@ func (c *HealthChecksCompletion) CompletionFunc(cmd *cobra.Command, args []strin
253251 if len (args ) == 0 {
254252 healthTypeCompletion := HealthTypeCompletion {ArgsLen : 0 , ConfigFile : c .ConfigFile }
255253 return healthTypeCompletion .CompletionFunc (cmd , args , toComplete )
256- } else {
257- probeTypeCompletion := ProbeTypeCompletion {ArgsLen : 1 , ConfigFile : c .ConfigFile }
258- return probeTypeCompletion .CompletionFunc (cmd , args , toComplete )
259254 }
255+ probeTypeCompletion := ProbeTypeCompletion {ArgsLen : 1 , ConfigFile : c .ConfigFile }
256+ return probeTypeCompletion .CompletionFunc (cmd , args , toComplete )
260257}
261258
262259type ServiceProtocolCompletion struct {
@@ -555,7 +552,7 @@ type ResourcePlanCompletion struct {
555552 ConfigFile * string
556553}
557554
558- func (c * ResourcePlanCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
555+ func (c * ResourcePlanCompletion ) CompletionFunc (_ * cobra.Command , args []string , _ string ) ([]string , cobra.ShellCompDirective ) {
559556 if s , err := settings .Load (* c .ConfigFile ); err == nil && (c .ArgsLen < 0 || len (args ) == c .ArgsLen ) {
560557 var results []string
561558 if services , _ , err := resources .Plans (s .Client , c .Service , - 1 ); err == nil {
@@ -735,12 +732,12 @@ func (c *TagCompletion) CompletionFunc(_ *cobra.Command, args []string, toComple
735732 return nil , cobra .ShellCompDirectiveNoFileComp
736733}
737734
738- type TlsActionCompletion struct {
735+ type TLSActionCompletion struct {
739736 ArgsLen int
740737 ConfigFile * string
741738}
742739
743- func (c * TlsActionCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
740+ func (c * TLSActionCompletion ) CompletionFunc (_ * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
744741 actions := []string {"enable" , "disable" }
745742 if c .ArgsLen < 0 || len (args ) == c .ArgsLen {
746743
0 commit comments