fix: UI handling bugs

This commit is contained in:
abhisek
2025-05-15 15:32:24 +05:30
parent 72819e8a99
commit 9bb6bbfe6b
3 changed files with 5 additions and 7 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ package npm
import ( import (
_ "embed" _ "embed"
"github.com/safedep/dry/log"
"github.com/safedep/pmg/config" "github.com/safedep/pmg/config"
"github.com/safedep/pmg/internal/ui" "github.com/safedep/pmg/internal/ui"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@@ -21,7 +22,7 @@ func NewNpmCommand() *cobra.Command {
err = executeNpmFlow(cmd.Context(), config, args) err = executeNpmFlow(cmd.Context(), config, args)
if err != nil { if err != nil {
ui.Fatalf("Failed to execute npm flow: %s", err) log.Errorf("Failed to execute npm flow: %s", err)
} }
return nil return nil
+2 -1
View File
@@ -3,6 +3,7 @@ package npm
import ( import (
_ "embed" _ "embed"
"github.com/safedep/dry/log"
"github.com/safedep/pmg/config" "github.com/safedep/pmg/config"
"github.com/safedep/pmg/internal/ui" "github.com/safedep/pmg/internal/ui"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@@ -21,7 +22,7 @@ func NewPnpmCommand() *cobra.Command {
err = executePnpmFlow(cmd.Context(), config, args) err = executePnpmFlow(cmd.Context(), config, args)
if err != nil { if err != nil {
ui.Fatalf("Failed to execute pnpm flow: %s", err) log.Errorf("Failed to execute pnpm flow: %s", err)
} }
return nil return nil
+1 -5
View File
@@ -42,11 +42,7 @@ func (npm *npmPackageManager) Name() string {
} }
func (npm *npmPackageManager) ParseCommand(args []string) (*ParsedCommand, error) { func (npm *npmPackageManager) ParseCommand(args []string) (*ParsedCommand, error) {
if len(args) == 0 { if len(args) > 0 && (args[0] == "npm" || args[0] == "pnpm") {
return nil, fmt.Errorf("no command specified")
}
if args[0] == "npm" || args[0] == "pnpm" {
args = args[1:] args = args[1:]
} }