beegoinit-cmd/main.go
2020-08-31 11:56:54 +08:00

53 lines
1.6 KiB
Go

package main
import (
"fmt"
"github.com/gookit/color"
"github.com/urfave/cli/v2"
"golib.gaore.com/GaoreGo/beegoinit-cmd/cmd"
"log"
"os"
"time"
)
func main() {
logo := color.Yellow.Sprint(" _____ ____________ _ _ _ \n")
logo += color.Yellow.Sprint("| __ \\| ___ \\ ___ \\ (_) (_) | \n")
logo += color.Yellow.Sprint("| | \\/| |_/ / |_/ / ___ ___ __ _ ___ _ _ __ _| |_ \n")
logo += color.Yellow.Sprint("| | __ | /| ___ \\/ _ \\/ _ \\/ _` |/ _ \\ | | '_ \\| | __|\n")
logo += color.Yellow.Sprint("| |_\\ \\| |\\ \\| |_/ / __/ __/ (_| | (_) | | | | | | | |_ \n")
logo += color.Yellow.Sprint(" \\____/\\_| \\_\\____/ \\___|\\___|\\__, |\\___/ |_|_| |_|_|\\__|\n")
logo += color.Yellow.Sprint(" __/ | \n")
logo += color.Yellow.Sprint(" |___/ \n\n")
logo += color.Blue.Sprint(" ------ by http://www.patorjk.com/software/taag/ -------\n")
//red := color.Red.Render
//fmt.Println("how o %s", red(time.Now().Format(time.ANSIC)))
fmt.Println(logo)
app := cli.App{
Name: "beegoinit-cmd",
Usage: "Create a new project with beego init",
Commands: []*cli.Command{
{
Name: "create",
Aliases: []string{"c"},
Usage: "Create a new project with beego init",
Action: cmd.New,
},
{
Name: "date",
Aliases: []string{"d"},
Usage: "Print date",
Action: func(c *cli.Context) error {
fmt.Println(time.Now().Format(time.RFC3339))
return nil
},
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}