mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix shell source line & trusted pkgs parsing
This commit is contained in:
+3
-3
@@ -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{}},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user