creator

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitCmd = climax.Command{
	Name:  "init",
	Brief: "Create a new Go app or library in an existing directory",
	Help:  "Create a new Go app or library in an existing directory",
	Flags: []climax.Flag{
		{
			Name:     "with-git",
			Short:    "",
			Usage:    `--with-git`,
			Help:     `Create a local git repository for this project`,
			Variable: false,
		},
		{
			Name:     "with-docker",
			Short:    "",
			Usage:    `--with-docker`,
			Help:     `Create a sample Dockerfile`,
			Variable: false,
		},
		{
			Name:     "with-github-action",
			Short:    "",
			Usage:    `--with-github-action`,
			Help:     `Create a sample Github Action workflow`,
			Variable: false,
		},
	},
	Handle: func(ctx climax.Context) int {

		withGit := ctx.Is("with-git")
		withDocker := ctx.Is("with-docker")
		withGithubAction := ctx.Is("with-github-action")

		tool := creator.Creator{
			Mode:             creator.InitProject,
			WithGit:          withGit,
			WithDocker:       withDocker,
			WithGithubAction: withGithubAction,
		}

		executor := internal.NewExecutor("")
		return executor.RunTool(tool, false)

	},
}

InitCmd defines the init command

View Source
var NewCmd = climax.Command{
	Name:  "new",
	Brief: "Create a new Go app or library",
	Help:  "Create a new Go app or library",
	Flags: []climax.Flag{
		{
			Name:     "path",
			Short:    "",
			Usage:    `--path=<target-path>`,
			Help:     `The path where the command should be created`,
			Variable: true,
		},
		{
			Name:     "package",
			Short:    "",
			Usage:    `--package=<package>`,
			Help:     `The package for the project`,
			Variable: true,
		},
		{
			Name:     "name",
			Short:    "",
			Usage:    `--name=<name>`,
			Help:     `The name of the project`,
			Variable: true,
		},
		{
			Name:     "description",
			Short:    "",
			Usage:    `--description=<description>`,
			Help:     `The description of the project`,
			Variable: true,
		},
		{
			Name:     "copyright",
			Short:    "",
			Usage:    `--copyright=<copyright>`,
			Help:     `The copyright of the project`,
			Variable: true,
		},
		{
			Name:     "overwrite",
			Short:    "",
			Usage:    `--overwrite`,
			Help:     `Overwrite the destination path if it exists already`,
			Variable: false,
		},
		{
			Name:     "with-git",
			Short:    "",
			Usage:    `--with-git`,
			Help:     `Create a local git repository for this project`,
			Variable: false,
		},
		{
			Name:     "with-docker",
			Short:    "",
			Usage:    `--with-docker`,
			Help:     `Create a sample Dockerfile`,
			Variable: false,
		},
		{
			Name:     "with-github-action",
			Short:    "",
			Usage:    `--with-github-action`,
			Help:     `Create a sample Github Action workflow`,
			Variable: false,
		},
	},
	Handle: func(ctx climax.Context) int {

		path, _ := ctx.Get("path")
		packageName, _ := ctx.Get("package")
		name, _ := ctx.Get("name")
		description, _ := ctx.Get("description")
		copyright, _ := ctx.Get("copyright")
		overwrite := ctx.Is("overwrite")
		withGit := ctx.Is("with-git")
		withDocker := ctx.Is("with-docker")
		withGithubAction := ctx.Is("with-github-action")

		tool := creator.Creator{
			Mode:             creator.NewProject,
			Path:             path,
			Package:          packageName,
			Name:             name,
			Description:      description,
			Copyright:        copyright,
			Overwrite:        overwrite,
			WithGit:          withGit,
			WithDocker:       withDocker,
			WithGithubAction: withGithubAction,
		}

		executor := internal.NewExecutor("")
		return executor.RunTool(tool, false)

	},
}

NewCmd defines the new command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL