beegoinit-cmd/main.go

53 lines
1.6 KiB
Go
Raw Normal View History

2020-08-31 10:58:26 +08:00
package main
import (
"fmt"
"github.com/gookit/color"
2020-08-31 11:56:54 +08:00
"github.com/urfave/cli/v2"
2020-08-31 11:07:18 +08:00
"golib.gaore.com/GaoreGo/beegoinit-cmd/cmd"
2020-08-31 11:56:54 +08:00
"log"
"os"
"time"
2020-08-31 10:58:26 +08:00
)
func main() {
2020-08-31 11:07:18 +08:00
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)
2020-08-31 11:56:54 +08:00
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)
}
2020-08-31 10:58:26 +08:00
}