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 {
return err
}
return inst.Install(cmd.Context(), offlineInstall)
return inst.Install(cmd.Context())
}
return cmd
}

View File

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

View File

@ -76,10 +76,11 @@ type installer struct {
// command instance is used for:
// - auth profile flag override
// - 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()
if err != nil {
return fmt.Errorf("folders: %w", err)
@ -101,7 +102,7 @@ func (i *installer) Install(ctx context.Context, offlineInstall bool) error {
} else if err != nil {
return fmt.Errorf("login: %w", err)
}
if !offlineInstall {
if !i.offlineInstall {
err = i.downloadLibrary(ctx)
if err != nil {
return fmt.Errorf("lib: %w", err)