Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BuildCmd = &cli.Command{ Name: "build", Usage: "Build the main executable of your project", Description: "Build the main executable of your project", Flags: []cli.Flag{ &cli.StringFlag{ Name: "output", Aliases: []string{"o"}, Usage: `The path where the executable should be stored`, }, &cli.StringFlag{ Name: "goos", Usage: `The goos to build for`, }, &cli.StringFlag{ Name: "goarch", Usage: `The goarch to build for`, }, }, Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) log.Debug("working on cmd: build") tool := internal.Builder{ OutputPath: cxt.String("output"), GOOS: cxt.String("goos"), GOARCH: cxt.String("goarch"), Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "build", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
BuildCmd defines the build command
View Source
var CleanCmd = &cli.Command{ Name: "clean", Usage: "Removes the build artifacts", Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.Cleaner{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "clean", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
CleanCmd defines the clean command
View Source
var DebugCmd = &cli.Command{ Name: "debug", Usage: "Debug a binary or example using delve", Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.Debugger{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "debug", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
DebugCmd implements the debug command
View Source
var DockerImageCmd = &cli.Command{ Name: "docker-image", Usage: "Builds the project as a docker image", Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.DockerImager{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "docker-image", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
DockerImageCmd defines the docker-image command
View Source
var InitCmd = &cli.Command{ Name: "init", Usage: "Create a new Go app or library in an existing directory", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "with-git", Usage: `Create a local git repository for this project`, }, &cli.BoolFlag{ Name: "with-docker", Usage: `Create a sample Dockerfile`, }, &cli.BoolFlag{ Name: "with-github-action", Usage: `Create a sample Github Action workflow`, }, &cli.BoolFlag{ Name: "with-gitlab-ci", Usage: `Create a sample Gitlab-CI workflow`, }, }, Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := creator.Creator{ Mode: creator.InitProject, WithGit: cxt.Bool("with-git"), WithDocker: cxt.Bool("with-docker"), WithGithubAction: cxt.Bool("with-github-action"), WithGitlabCI: cxt.Bool("with-gitlab-ci"), Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "init", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
InitCmd defines the init command
View Source
var InstallCmd = &cli.Command{ Name: "install", Usage: "Build the executable and install it in $GOPATH/bin", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Usage: `print the names of packages as they are compiled.`, }, }, Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.Installer{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "install", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
InstallCmd implements the install command
View Source
var NewCmd = &cli.Command{ Name: "new", Usage: "Create a new Go app or library", Flags: []cli.Flag{ &cli.StringFlag{ Name: "type", Usage: `type of application should be created, available: cli, web, lib`, }, &cli.StringFlag{ Name: "path", Usage: `The path where the command should be created`, }, &cli.StringFlag{ Name: "package", Usage: `The package for the project`, }, &cli.StringFlag{ Name: "name", Usage: `The name of the project`, }, &cli.StringFlag{ Name: "description", Usage: `The description of the project`, }, &cli.StringFlag{ Name: "copyright", Usage: `The copyright of the project`, }, &cli.BoolFlag{ Name: "overwrite", Usage: `Overwrite the destination path if it exists already`, }, &cli.BoolFlag{ Name: "with-git", Usage: `Create a local git repository for this project`, }, &cli.BoolFlag{ Name: "with-docker", Usage: `Create a sample Dockerfile`, }, &cli.BoolFlag{ Name: "with-github-action", Usage: `Create a sample Github Action workflow`, }, &cli.BoolFlag{ Name: "with-gitlab-ci", Usage: `Create a sample Gitlab-CI workflow`, }, }, Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := creator.Creator{ Mode: creator.NewProject, Path: cxt.String("path"), Package: cxt.String("package"), Name: cxt.String("name"), Description: cxt.String("description"), Copyright: cxt.String("copyright"), Overwrite: cxt.Bool("overwrite"), WithGit: cxt.Bool("with-git"), WithDocker: cxt.Bool("with-docker"), WithGithubAction: cxt.Bool("with-github-action"), WithGitlabCI: cxt.Bool("with-gitlab-ci"), Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "new", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
NewCmd defines the new command
View Source
var PackageCmd = &cli.Command{ Name: "package", Usage: "Build the main executable of your project for windows / linux / mac", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "verbose", Aliases: []string{"v"}, Usage: `print the names of packages as they are compiled`, }, &cli.StringFlag{ Name: "concurrency", Aliases: []string{"c"}, Usage: `how many package processes can run simultaneously (defaults to the number of CPUs).`, }, }, Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) concurrency := cxt.String("concurrency") concurrencyAsInt, _ := strconv.Atoi(concurrency) tool := internal.Packager{ Concurrency: concurrencyAsInt, Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "package", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
PackageCmd defines the package command
View Source
var RunCmd = &cli.Command{ Name: "run", Usage: "Run a binary or example of the local package", Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.Runner{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "run", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
RunCmd implements the run command
View Source
var StaticcheckCmd = &cli.Command{ Name: "staticcheck", Usage: "Perform a static analysis of the code using staticcheck", Flags: []cli.Flag{}, Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.StaticChecker{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "staticcheck", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
StaticcheckCmd defines the build command
View Source
var TestCmd = &cli.Command{ Name: "test", Usage: "Run the tests", Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.Tester{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "test", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
TestCmd implements the test command
View Source
var UninstallCmd = &cli.Command{ Name: "uninstall", Usage: "Removes the executable from $GOPATH/bin", Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.Uninstaller{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "uninstall", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
UninstallCmd implements the uninstall command
View Source
var VersionCmd = &cli.Command{ Name: "version", Usage: "Print version info and exit", Action: func(cxt *cli.Context) error { log = common.InitGetLogger(cxt.String("log-level")) tool := internal.Version{ Verbose: cxt.Bool("verbose"), LogLevel: cxt.String("log-level"), LogDir: cxt.String("log-dir"), } project := common.NewProject("", "") cfg, result := GetConfigAndBuild(project, "version", true, "", tool.LogLevel, tool.Verbose) if result != 0 { return errors.New("error in reading config or dependent job, possibly: BuildCmd") } return tool.Execute(project, cfg) }, }
VersionCmd defines the version command
Functions ¶
func GetConfigAndBuild ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.