mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
feat: add manifest-based package installation detection
This commit is contained in:
@@ -30,12 +30,28 @@ type ParsedCommand struct {
|
||||
|
||||
// Parsed install target if this is an install command
|
||||
InstallTargets []*PackageInstallTarget
|
||||
|
||||
// IsManifestInstall indicates if this is a manifest-based installation
|
||||
// (e.g., npm install, pip install -r requirements.txt)
|
||||
IsManifestInstall bool
|
||||
|
||||
// ManifestFiles contains the list of manifest files to install from
|
||||
// (e.g., ["requirements.txt"] for pip install -r requirements.txt)
|
||||
ManifestFiles []string
|
||||
}
|
||||
|
||||
func (pc *ParsedCommand) HasInstallTarget() bool {
|
||||
return len(pc.InstallTargets) > 0
|
||||
}
|
||||
|
||||
func (pc *ParsedCommand) HasManifestInstall() bool {
|
||||
return pc.IsManifestInstall
|
||||
}
|
||||
|
||||
func (pc *ParsedCommand) ShouldExtractFromManifest() bool {
|
||||
return pc.IsManifestInstall && !pc.HasInstallTarget()
|
||||
}
|
||||
|
||||
// PackageManager is the contract for implementing a package manager
|
||||
type PackageManager interface {
|
||||
// Name of the package manager implementation
|
||||
|
||||
Reference in New Issue
Block a user