Add bug command
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
318ff52ff3
commit
6adb346cee
6 changed files with 215 additions and 68 deletions
48
traefik.go
48
traefik.go
|
@ -10,7 +10,6 @@ import (
|
|||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
|
@ -18,6 +17,7 @@ import (
|
|||
"github.com/containous/staert"
|
||||
"github.com/containous/traefik/acme"
|
||||
"github.com/containous/traefik/cluster"
|
||||
"github.com/containous/traefik/cmd"
|
||||
"github.com/containous/traefik/log"
|
||||
"github.com/containous/traefik/middlewares"
|
||||
"github.com/containous/traefik/provider/k8s"
|
||||
|
@ -29,12 +29,6 @@ import (
|
|||
"github.com/satori/go.uuid"
|
||||
)
|
||||
|
||||
var versionTemplate = `Version: {{.Version}}
|
||||
Codename: {{.Codename}}
|
||||
Go version: {{.GoVersion}}
|
||||
Built: {{.BuildTime}}
|
||||
OS/Arch: {{.Os}}/{{.Arch}}`
|
||||
|
||||
func main() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
|
@ -54,43 +48,6 @@ Complete documentation is available at https://traefik.io`,
|
|||
},
|
||||
}
|
||||
|
||||
//version Command init
|
||||
versionCmd := &flaeg.Command{
|
||||
Name: "version",
|
||||
Description: `Print version`,
|
||||
Config: struct{}{},
|
||||
DefaultPointersConfig: struct{}{},
|
||||
Run: func() error {
|
||||
tmpl, err := template.New("").Parse(versionTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v := struct {
|
||||
Version string
|
||||
Codename string
|
||||
GoVersion string
|
||||
BuildTime string
|
||||
Os string
|
||||
Arch string
|
||||
}{
|
||||
Version: version.Version,
|
||||
Codename: version.Codename,
|
||||
GoVersion: runtime.Version(),
|
||||
BuildTime: version.BuildDate,
|
||||
Os: runtime.GOOS,
|
||||
Arch: runtime.GOARCH,
|
||||
}
|
||||
|
||||
if err := tmpl.Execute(os.Stdout, v); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
return nil
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
//storeconfig Command init
|
||||
var kv *staert.KvSource
|
||||
var err error
|
||||
|
@ -151,7 +108,8 @@ Complete documentation is available at https://traefik.io`,
|
|||
f.AddParser(reflect.TypeOf([]acme.Domain{}), &acme.Domains{})
|
||||
|
||||
//add commands
|
||||
f.AddCommand(versionCmd)
|
||||
f.AddCommand(cmd.NewVersionCmd())
|
||||
f.AddCommand(cmd.NewBugCmd(traefikConfiguration, traefikPointersConfiguration))
|
||||
f.AddCommand(storeconfigCmd)
|
||||
|
||||
usedCmd, err := f.GetCommand()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue