From 188ec79848f4363413e9adc567028df6c0c67927 Mon Sep 17 00:00:00 2001 From: Erik Kristensen Date: Sat, 9 Nov 2024 22:26:34 -0700 Subject: [PATCH] fix: nil pointer --- pkg/commands/install/install.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/commands/install/install.go b/pkg/commands/install/install.go index 6b5ccd6..02268c9 100644 --- a/pkg/commands/install/install.go +++ b/pkg/commands/install/install.go @@ -84,7 +84,7 @@ func Execute(c *cli.Context) error { if c.String("version") == "latest" && !c.Bool("force") { latestInstalled := inv.GetLatestVersion(fmt.Sprintf("%s/%s", src.GetSource(), src.GetApp())) - if latestInstalled.Version == src.GetVersion() { + if latestInstalled != nil && latestInstalled.Version == src.GetVersion() { log.Warnf("already installed") log.Infof("reinstall with --force (%s)", time.Since(start)) return nil @@ -207,15 +207,22 @@ func Flags() []cli.Flag { Aliases: []string{"pre"}, }, &cli.BoolFlag{ - Name: "no-checksum-verify", - Usage: "disable checksum verification", + Name: "no-checksum-verify", + Usage: "disable checksum verification", + EnvVars: []string{"DISTILLERY_NO_CHECKSUM_VERIFY"}, + }, + &cli.BoolFlag{ + Name: "no-signature-verify", + Usage: "disable signature verification", + EnvVars: []string{"DISTILLERY_NO_SIGNATURE_VERIFY"}, }, &cli.BoolFlag{ Name: "no-score-check", Usage: "disable scoring check", }, &cli.BoolFlag{ - Name: "force", + Name: "force", + Usage: "force the installation of the binary even if it is already installed", }, } }