Files
pmg/main.go
T

40 lines
745 B
Go
Raw Normal View History

package main
import (
"fmt"
"os"
2025-04-09 23:27:46 +05:30
"github.com/safedep/dry/log"
2025-04-30 14:26:38 +05:30
"github.com/safedep/pmg/cmd/npm"
"github.com/spf13/cobra"
)
2025-04-09 23:27:46 +05:30
func main() {
var debug bool
cmd := &cobra.Command{
Use: "pmg",
TraverseChildren: true,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if debug {
log.Init("pmg-logger", "debug")
}
},
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return nil
}
return fmt.Errorf("pmg: %s is not a valid command", args[0])
},
}
cmd.PersistentFlags().BoolVar(&debug, "debug", false, "Enable debug logging")
2025-04-30 14:26:38 +05:30
cmd.AddCommand(npm.NewNpmCommand())
cmd.AddCommand(npm.NewPnpmCommand())
if err := cmd.Execute(); err != nil {
os.Exit(1)
}
}