@@ -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 {
@@ -361,12 +358,12 @@ func (c *LimitSetPlanCompletion) CompletionFunc(cmd *cobra.Command, args []strin
361358 }
362359 }
363360 return results , cobra .ShellCompDirectiveNoFileComp
364- } else {
365- ptsSetArgsCompletion := PtsSetArgsCompletion {
366- PtsCompletion : & PtsCompletion {AppID : c .AppID , ArgsLen : - 1 , ConfigFile : c .ConfigFile },
367- }
368- return ptsSetArgsCompletion .CompletionFunc (cmd , args , toComplete )
369361 }
362+ ptsSetArgsCompletion := PtsSetArgsCompletion {
363+ PtsCompletion : & PtsCompletion {AppID : c .AppID , ArgsLen : - 1 , ConfigFile : c .ConfigFile },
364+ }
365+ return ptsSetArgsCompletion .CompletionFunc (cmd , args , toComplete )
366+
370367}
371368
372369type UserPermsCompletion struct {
@@ -439,12 +436,11 @@ func (c *PermUpdateCompletion) CompletionFunc(cmd *cobra.Command, args []string,
439436 if len (args ) == 0 {
440437 permUsernameCompletion := PermUsernameCompletion {AppID : c .AppID , ArgsLen : 0 , ConfigFile : c .ConfigFile }
441438 return permUsernameCompletion .CompletionFunc (cmd , args , toComplete )
442- } else {
443- userPermsArgsCompletion := UserPermsArgsCompletion {
444- UserPermsCompletion : & UserPermsCompletion {ConfigFile : c .ConfigFile },
445- }
446- return userPermsArgsCompletion .CompletionFunc (cmd , args , toComplete )
447439 }
440+ userPermsArgsCompletion := UserPermsArgsCompletion {
441+ UserPermsCompletion : & UserPermsCompletion {ConfigFile : c .ConfigFile },
442+ }
443+ return userPermsArgsCompletion .CompletionFunc (cmd , args , toComplete )
448444}
449445
450446type PsCompletion 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,12 +731,12 @@ 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 {
746742
@@ -828,12 +824,11 @@ func (c *VolumesMountCompletion) CompletionFunc(cmd *cobra.Command, args []strin
828824 if len (args ) == 0 {
829825 volumeCompletion := VolumeCompletion {AppID : c .AppID , ArgsLen : 0 , ConfigFile : c .ConfigFile }
830826 return volumeCompletion .CompletionFunc (cmd , args , toComplete )
831- } else {
832- ptsSetArgsCompletion := PtsSetArgsCompletion {
833- PtsCompletion : & PtsCompletion {AppID : c .AppID , ArgsLen : - 1 , ConfigFile : c .ConfigFile },
834- }
835- return ptsSetArgsCompletion .CompletionFunc (cmd , args , toComplete )
836827 }
828+ ptsSetArgsCompletion := PtsSetArgsCompletion {
829+ PtsCompletion : & PtsCompletion {AppID : c .AppID , ArgsLen : - 1 , ConfigFile : c .ConfigFile },
830+ }
831+ return ptsSetArgsCompletion .CompletionFunc (cmd , args , toComplete )
837832}
838833
839834type VolumesUnmountCompletion struct {
@@ -846,12 +841,11 @@ func (c *VolumesUnmountCompletion) CompletionFunc(cmd *cobra.Command, args []str
846841 if len (args ) == 0 {
847842 volumeCompletion := VolumeCompletion {AppID : c .AppID , ArgsLen : 0 , ConfigFile : c .ConfigFile }
848843 return volumeCompletion .CompletionFunc (cmd , args , toComplete )
849- } else {
850- ptsArgCompletion := PtsArgsCompletion {
851- PtsCompletion : & PtsCompletion {AppID : c .AppID , ArgsLen : - 1 , ConfigFile : c .ConfigFile },
852- }
853- return ptsArgCompletion .CompletionFunc (cmd , args , toComplete )
854844 }
845+ ptsArgCompletion := PtsArgsCompletion {
846+ PtsCompletion : & PtsCompletion {AppID : c .AppID , ArgsLen : - 1 , ConfigFile : c .ConfigFile },
847+ }
848+ return ptsArgCompletion .CompletionFunc (cmd , args , toComplete )
855849}
856850
857851type VolumesCmdCompletion struct {
0 commit comments