review comments

This commit is contained in:
hari-selvarajan_data 2024-12-27 08:14:31 +00:00
parent d846c91f96
commit 2bcfa22a5b
3 changed files with 11 additions and 9 deletions

View File

@ -20,7 +20,7 @@ func newInstallCommand() *cobra.Command {
if err != nil { if err != nil {
return err return err
} }
return inst.Install(cmd.Context(), offlineInstall) return inst.Install(cmd.Context())
} }
return cmd return cmd
} }

View File

@ -15,7 +15,7 @@ import (
) )
type installable interface { type installable interface {
Install(ctx context.Context, offlineInstall bool) error Install(ctx context.Context) error
} }
type devInstallation struct { type devInstallation struct {
@ -23,7 +23,7 @@ type devInstallation struct {
*cobra.Command *cobra.Command
} }
func (d *devInstallation) Install(ctx context.Context, offlineInstall bool) error { func (d *devInstallation) Install(ctx context.Context) error {
if d.Installer == nil { if d.Installer == nil {
return nil return nil
} }
@ -87,9 +87,10 @@ func NewInstaller(cmd *cobra.Command, name string, offlineInstall bool) (install
} }
return &installer{ return &installer{
Project: prj, Project: prj,
version: version, version: version,
cmd: cmd, cmd: cmd,
offlineInstall: offlineInstall,
}, nil }, nil
} }

View File

@ -76,10 +76,11 @@ type installer struct {
// command instance is used for: // command instance is used for:
// - auth profile flag override // - auth profile flag override
// - standard input, output, and error streams // - standard input, output, and error streams
cmd *cobra.Command cmd *cobra.Command
offlineInstall bool
} }
func (i *installer) Install(ctx context.Context, offlineInstall bool) error { func (i *installer) Install(ctx context.Context) error {
err := i.EnsureFoldersExist() err := i.EnsureFoldersExist()
if err != nil { if err != nil {
return fmt.Errorf("folders: %w", err) return fmt.Errorf("folders: %w", err)
@ -101,7 +102,7 @@ func (i *installer) Install(ctx context.Context, offlineInstall bool) error {
} else if err != nil { } else if err != nil {
return fmt.Errorf("login: %w", err) return fmt.Errorf("login: %w", err)
} }
if !offlineInstall { if !i.offlineInstall {
err = i.downloadLibrary(ctx) err = i.downloadLibrary(ctx)
if err != nil { if err != nil {
return fmt.Errorf("lib: %w", err) return fmt.Errorf("lib: %w", err)