diff --git a/cmd/completion/completion.go b/cmd/completion/completion.go index d0a7bb6..e798d1a 100644 --- a/cmd/completion/completion.go +++ b/cmd/completion/completion.go @@ -37,10 +37,8 @@ type Completion struct { cloud *client.CloudAPI } -func NewCompletion(cloud *client.CloudAPI) *Completion { - return &Completion{ - cloud: cloud, - } +func (c *Completion) SetClient(client *client.CloudAPI) { + c.cloud = client } func (c *Completion) ContextListCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { diff --git a/cmd/root.go b/cmd/root.go index e80b9a0..79ac022 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -184,7 +184,7 @@ func initConfigWithViperCtx(cfg *config) error { } cfg.cloud = cloud - cfg.comp = completion.NewCompletion(cloud) + cfg.comp.SetClient(cloud) parsedURL, err := url.Parse(driverURL) if err != nil {