mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
small fixes
This commit is contained in:
+3
-3
@@ -70,13 +70,13 @@ func NewRemoveCommand() *cobra.Command {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
config := alias.DefaultConfig()
|
cfg := alias.DefaultConfig()
|
||||||
rcFileManager, err := alias.NewDefaultRcFileManager(config.RcFileName)
|
rcFileManager, err := alias.NewDefaultRcFileManager(cfg.RcFileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
aliasManager := alias.New(config, rcFileManager)
|
aliasManager := alias.New(cfg, rcFileManager)
|
||||||
return aliasManager.Remove()
|
return aliasManager.Remove()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ type Config struct {
|
|||||||
// InsecureInstallation allows bypassing install blocking on malicious packages
|
// InsecureInstallation allows bypassing install blocking on malicious packages
|
||||||
InsecureInstallation bool `mapstructure:"insecure_installation"`
|
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"`
|
TrustedPackages TrustedPackage `mapstructure:"trusted_packages"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ transitive_depth: 7
|
|||||||
include_dev_dependencies: true
|
include_dev_dependencies: true
|
||||||
dry_run: true
|
dry_run: true
|
||||||
paranoid: true
|
paranoid: true
|
||||||
trusted_packages: ["a","b"]
|
trusted_packages: {'purls': ["a", "b"]}
|
||||||
`), 0o644))
|
`), 0o644))
|
||||||
|
|
||||||
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
|
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.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.DryRun, "dry_run should be overridden by file to true")
|
||||||
assert.True(t, cfg.Paranoid, "paranoid 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")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
globalConfig = cfg
|
globalConfig = cfg
|
||||||
|
|
||||||
fmt.Printf("Config: %+v", globalConfig)
|
|
||||||
log.InitZapLogger("pmg", "cli")
|
log.InitZapLogger("pmg", "cli")
|
||||||
cmd.SetContext(globalConfig.Inject(cmd.Context()))
|
cmd.SetContext(globalConfig.Inject(cmd.Context()))
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user