fix shell source line & trusted pkgs parsing

This commit is contained in:
Sahilb315
2025-12-18 00:01:06 +05:30
parent fcc1b628c2
commit adec9b67ca
4 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -36,8 +36,8 @@ type Config struct {
}
type TrustedPackage struct {
// Purl of the trusted package. Eg. pkg:npm/express@5.2.1
Purl []string `mapstructure:"purls"`
// Purls of the trusted package. Eg. pkg:npm/express@5.2.1
Purls []string `mapstructure:"purls"`
}
var (
@@ -57,7 +57,7 @@ func DefaultConfig() Config {
Paranoid: false,
DryRun: false,
InsecureInstallation: false,
TrustedPackages: TrustedPackage{Purl: []string{}},
TrustedPackages: TrustedPackage{Purls: []string{}},
}
}
+1 -1
View File
@@ -107,5 +107,5 @@ trusted_packages: {'purls': ["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.Purl, "trusted_packages should match file values")
assert.ElementsMatch(t, []string{"a", "b"}, cfg.TrustedPackages.Purls, "trusted_packages should match file values")
}
+1 -1
View File
@@ -276,7 +276,7 @@ func (g *packageManagerGuard) isTrustedConfirmable(result *analyzer.PackageVersi
return false
}
trustedPkgs := g.config.TrustedPackages.Purl
trustedPkgs := g.config.TrustedPackages.Purls
if len(trustedPkgs) == 0 {
return false
}
+1 -1
View File
@@ -11,5 +11,5 @@ type Shell interface {
var commentForRemovingShellSource = "# remove aliases by running `pmg setup remove` or deleting the line"
func defaultShellSource(rcPath string) string {
return fmt.Sprintf("%s \n[ -f %s ] && source %s # PMG source aliases\n", commentForRemovingShellSource, rcPath, rcPath)
return fmt.Sprintf("%s \n[ -f '%s' ] && source '%s' # PMG source aliases\n", commentForRemovingShellSource, rcPath, rcPath)
}