goproject

package
v0.0.0-...-0730a73 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package goproject contains GoCmd which generates new go project using template.

Index

Constants

This section is empty.

Variables

View Source
var GoCmd = &cobra.Command{
	Use:   "go",
	Short: "Start a new project using 'go' template",
	Long:  "Start a new project using 'go' template",
	Run: func(cmd *cobra.Command, args []string) {
		answers := struct {
			License            string
			ProjectDescription string
			ProjectName        string
		}{}
		if err := survey.Ask(questions, &answers); err != nil {
			utils.ExitOnError(err)
		}
		templates := []string{"new/go", "new/github", "new/license"}
		requireMap := map[string]interface{}{}
		replaceMap := map[string]interface{}{
			"author":             config.GetConfigByField("author"),
			"email":              config.GetConfigByField("email"),
			"githubUser":         config.GetConfigByField("githubUser"),
			"license":            answers.License,
			"projectDescription": answers.ProjectDescription,
			"projectName":        answers.ProjectName,
		}
		utils.GenerateFile(templates, answers.ProjectName, requireMap, replaceMap)

		bold := color.New(color.Bold).SprintFunc()
		boldCyan := color.New(color.FgCyan, color.Bold).SprintFunc()

		fmt.Println()
		fmt.Printf("%s%s%s\n", bold("This project uses "), boldCyan("Dep (Dependency management for Go)"), bold(", see more detail here: https://golang.github.io/dep/"))
		fmt.Printf("%s%s%s\n", bold("This project follows "), boldCyan("Standard Go Project Layout"), bold(", see more detail here: https://github.com/golang-standards/project-layout/"))
	},
}

GoCmd generates new go project using template.

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