project init
This commit is contained in:
parent
f828e3090d
commit
77010a08b7
31
cmd/new.go
31
cmd/new.go
@ -1,5 +1,34 @@
|
||||
package cmd
|
||||
|
||||
func New() {
|
||||
import "github.com/urfave/cli/v2"
|
||||
|
||||
var gitignore = `# Created by .ignore support plugin (hsz.mobi)
|
||||
### Example user template template
|
||||
### Example user template
|
||||
|
||||
# IntelliJ project files
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
gen
|
||||
/runtime
|
||||
### Go template
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with 'go test -c\'
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/`
|
||||
|
||||
func New(c *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
9
go.mod
Normal file
9
go.mod
Normal file
@ -0,0 +1,9 @@
|
||||
module golib.gaore.com/GaoreGo/beegoinit-cmd
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
||||
github.com/gookit/color v1.2.8
|
||||
github.com/urfave/cli/v2 v2.2.0
|
||||
)
|
31
main.go
31
main.go
@ -3,7 +3,11 @@ 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() {
|
||||
@ -19,5 +23,30 @@ func main() {
|
||||
//red := color.Red.Render
|
||||
//fmt.Println("how o %s", red(time.Now().Format(time.ANSIC)))
|
||||
fmt.Println(logo)
|
||||
cmd.New()
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user