mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
refactor and introduce tests for npm & pypi (#79)
* refactor and introduce tests for npm & pypi * refactor and introduce tests for npm & pypi * add skip intermediate flags test case * fix tests --------- Co-authored-by: Abhisek Datta <abhisek.datta@gmail.com>
This commit is contained in:
co-authored by
Abhisek Datta
parent
2be1e5f009
commit
a8723cd680
@@ -103,7 +103,7 @@ func NewPipCommandParser(config PypiPackageManagerConfig) pypiCommandParser {
|
||||
|
||||
func (p *pipCommandParser) ParseCommand(args []string) (*ParsedCommand, error) {
|
||||
// Remove 'pip' if it's the first argument
|
||||
if len(args) > 0 && args[0] == "pip" {
|
||||
if len(args) > 0 && (args[0] == "pip" || args[0] == "pip3") {
|
||||
args = args[1:]
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ func (p *pipCommandParser) ParseCommand(args []string) (*ParsedCommand, error) {
|
||||
// Extract arguments after the install command
|
||||
installArgs := args[installCmdIndex+1:]
|
||||
|
||||
flagSet := pflag.NewFlagSet("pip", pflag.ContinueOnError)
|
||||
flagSet := pflag.NewFlagSet(p.config.CommandName, pflag.ContinueOnError)
|
||||
flagSet.SetOutput(io.Discard)
|
||||
flagSet.ParseErrorsWhitelist.UnknownFlags = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user