60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
//
|
|
// cli_about.go
|
|
// Copyright (C) 2022 tiglog <me@tiglog.com>
|
|
//
|
|
// Distributed under terms of the MIT license.
|
|
//
|
|
|
|
package console
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"runtime"
|
|
)
|
|
|
|
type cAbout struct {
|
|
BaseCmd
|
|
cli IConsole
|
|
}
|
|
|
|
func NewAboutCmd(cli IConsole) *cAbout {
|
|
c := new(cAbout)
|
|
c.Name = "about"
|
|
c.Desc = "应用基本环境"
|
|
c.cli = cli
|
|
return c
|
|
}
|
|
|
|
func (c *cAbout) Init(args []string) {
|
|
|
|
c.Action = func() error {
|
|
fmt.Printf("About:\n")
|
|
fmt.Printf("==================================================\n")
|
|
fmt.Printf(" Version: %s\n", c.cli.GetVersion())
|
|
wd, _ := filepath.Abs("./")
|
|
fmt.Printf(" BaseDir: %s\n", wd)
|
|
fmt.Printf(" Env: %s\n", "dev")
|
|
fmt.Printf(" Debug: %v\n", true)
|
|
fmt.Printf(" GOOS: %s %s\n", runtime.GOOS, runtime.GOARCH)
|
|
|
|
hd := c.cli.GetExtraAbout()
|
|
if hd != nil {
|
|
return hd()
|
|
}
|
|
// if sqldb.Db != nil {
|
|
// fmt.Printf(" Db Type: %s\n", config.Conf.Db.Type)
|
|
// fmt.Printf(" Db Host: %s\n", config.Conf.Db.Host)
|
|
// fmt.Printf(" Db Port: %d\n", config.Conf.Db.Port)
|
|
// fmt.Printf(" Db Name: %s\n", config.Conf.Db.Name)
|
|
// fmt.Printf(" Db User: %s\n", config.Conf.Db.Username)
|
|
// }
|
|
return nil
|
|
}
|
|
|
|
}
|
|
|
|
func (c *cAbout) GetHelp() string {
|
|
return ""
|
|
}
|