hybridgroup.gobot/gobot/main.go

38 lines
555 B
Go

package main
import (
"fmt"
"github.com/gonuts/commander"
"github.com/gonuts/flag"
"os"
)
var g_cmd *commander.Commander
func init() {
g_cmd = &commander.Commander{
Name: os.Args[0],
Commands: []*commander.Command{
generate(),
},
Flag: flag.NewFlagSet("gobot", flag.ExitOnError),
}
}
func main() {
err := g_cmd.Flag.Parse(os.Args[1:])
if err != nil {
fmt.Printf("**err**: %v\n", err)
os.Exit(1)
}
args := g_cmd.Flag.Args()
err = g_cmd.Run(args)
if err != nil {
fmt.Printf("**err**: %v\n", err)
os.Exit(1)
}
return
}