framework1/framework/command/npm_cmd.go

20 lines
388 B
Go
Raw Normal View History

2024-10-22 17:06:36 +08:00
package command
import (
"github.com/Superdanda/hade/framework/cobra"
"log"
"os/exec"
)
var npmCommand = &cobra.Command{
Use: "npm",
Short: "运行npm命令要求npm必须安装",
RunE: func(c *cobra.Command, args []string) error {
path, err := exec.LookPath("npm")
if err != nil {
log.Fatalln("请在PATH路径中安装npm")
}
return runCommand(path, args)
},
}