Files
pmg/cmd/npm/npm.go
T

26 lines
544 B
Go
Raw Normal View History

2025-04-30 14:26:38 +05:30
package npm
import (
_ "embed"
2025-05-14 16:09:29 +05:30
"fmt"
2025-04-30 14:26:38 +05:30
2025-05-14 16:09:29 +05:30
"github.com/safedep/pmg/config"
2025-04-30 14:26:38 +05:30
"github.com/spf13/cobra"
)
func NewNpmCommand() *cobra.Command {
return &cobra.Command{
2025-04-30 14:26:38 +05:30
Use: "npm [action] [package]",
Short: "Guard npm package manager",
2025-04-30 14:26:38 +05:30
DisableFlagParsing: true,
RunE: func(cmd *cobra.Command, args []string) error {
2025-05-14 16:09:29 +05:30
config, err := config.FromContext(cmd.Context())
if err != nil {
return fmt.Errorf("failed to get config: %w", err)
}
return executeNpmFlow(cmd.Context(), config, args)
2025-04-30 14:26:38 +05:30
},
}
}