Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultConfFile default configuration file path
DefaultConfFile = "gbb.json"
)
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "gbb", Long: `Go project compilation assistant. Copyright (c) 2016-2020, voidint. All rights reserved.`, Run: func(cmd *cobra.Command, args []string) { begin := time.Now() if gopts.ConfigFile == DefaultConfFile { gopts.ConfigFile = filepath.Join(wd, "gbb.json") } if !util.FileExist(gopts.ConfigFile) { genConfigFile(gopts.ConfigFile) return } conf, err := config.Load(gopts.ConfigFile) if err != nil { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(-1) return } conf.Debug = gopts.Debug conf.All = gopts.All if conf.Version != Version { gt, err := util.VersionGreaterThan(Version, conf.Version) if err != nil { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(-1) return } if gt { fmt.Printf("Warning: The gbb.json file needs to be upgraded.\n\n") genConfigFile(gopts.ConfigFile) } else { fmt.Printf("Warning: This program needs to be upgraded by `go get -u -v github.com/voidint/gbb`\n\n") } return } defer func() { fmt.Printf("Time Used: %.2fs\n", time.Now().Sub(begin).Seconds()) }() if err := tool.Build(conf, wd); err != nil { fmt.Fprintln(os.Stderr, err.Error()) os.Exit(-1) return } }, }
RootCmd represents the base command when called without any subcommands
View Source
var (
// Version 版本号
Version = "0.6.1"
)
Functions ¶
Types ¶
type CleanOptions ¶ added in v0.6.1
type CleanOptions struct {
I bool // go clean -i
N bool // go clean -n
R bool // go clean -r
X bool // go clean -x
}
CleanOptions clean sub-command options
type GlobalOptions ¶ added in v0.6.1
GlobalOptions global options
Click to show internal directories.
Click to hide internal directories.