small fixes

This commit is contained in:
Sahilb315
2025-12-17 23:25:02 +05:30
parent 1655bf1921
commit 3bc4120375
4 changed files with 6 additions and 7 deletions
+3 -3
View File
@@ -70,13 +70,13 @@ func NewRemoveCommand() *cobra.Command {
return err
}
config := alias.DefaultConfig()
rcFileManager, err := alias.NewDefaultRcFileManager(config.RcFileName)
cfg := alias.DefaultConfig()
rcFileManager, err := alias.NewDefaultRcFileManager(cfg.RcFileName)
if err != nil {
return err
}
aliasManager := alias.New(config, rcFileManager)
aliasManager := alias.New(cfg, rcFileManager)
return aliasManager.Remove()
},
}
+1 -1
View File
@@ -31,7 +31,7 @@ type Config struct {
// InsecureInstallation allows bypassing install blocking on malicious packages
InsecureInstallation bool `mapstructure:"insecure_installation"`
// TrustedPackages allows for trusting an suspicious package and ignoring the suspicious behaviour for the package in future installations
// TrustedPackages allows for trusting a suspicious package and ignoring the suspicious behaviour for the package in future installations
TrustedPackages TrustedPackage `mapstructure:"trusted_packages"`
}
+2 -2
View File
@@ -69,7 +69,7 @@ transitive_depth: 7
include_dev_dependencies: true
dry_run: true
paranoid: true
trusted_packages: ["a","b"]
trusted_packages: {'purls': ["a", "b"]}
`), 0o644))
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
@@ -87,5 +87,5 @@ trusted_packages: ["a","b"]
assert.True(t, cfg.IncludeDevDependencies, "include_dev_dependencies should be overridden by file to true")
assert.True(t, cfg.DryRun, "dry_run should be overridden by file to true")
assert.True(t, cfg.Paranoid, "paranoid should be overridden by file to true")
assert.ElementsMatch(t, []string{"a", "b"}, cfg.TrustedPackages, "trusted_packages should match file values")
assert.ElementsMatch(t, []string{"a", "b"}, cfg.TrustedPackages.Purl, "trusted_packages should match file values")
}
-1
View File
@@ -63,7 +63,6 @@ func main() {
}
globalConfig = cfg
fmt.Printf("Config: %+v", globalConfig)
log.InitZapLogger("pmg", "cli")
cmd.SetContext(globalConfig.Inject(cmd.Context()))
},