generate

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MainFileContentWriter

type MainFileContentWriter func(w *bufio.Writer, pp string)

MainFileContentWriter creates a Go source file with main function that initialises and passes control to Granitic

type ModFileWriter

type ModFileWriter func(baseDir string, moduleName string, pg *ProjectGenerator)

ModFileWriter creates a go.mod file in the supplied location

type ProjectGenerator

type ProjectGenerator struct {
	ConfWriterFunc TemplateConfigWriter
	CompWriterFunc TemplateComponentWriter
	MainFileFunc   MainFileContentWriter
	ModFileFunc    ModFileWriter
	ToolName       string
}

ProjectGenerator creates a blank Granitic project that is ready to build and start

func (*ProjectGenerator) ExitError

func (pg *ProjectGenerator) ExitError(message string, a ...interface{})

ExitError writes

func (*ProjectGenerator) Generate

func (pg *ProjectGenerator) Generate(s Settings)

Generate creates the folder structure and blank/skeleton files for a new Granitic project that will be ready to build

func (*ProjectGenerator) OpenOutputFile

func (pg *ProjectGenerator) OpenOutputFile(p string) *os.File

OpenOutputFile opens the supplied file path in create mode. Exits if there is a problem opening the file.

type Settings

type Settings struct {
	ProjectName string
	ModuleName  string
	BaseFolder  string
}

Settings contains the arguments for this tool

func SettingsFromArgs

func SettingsFromArgs(ef exitFunc) Settings

SettingsFromArgs uses CLI parameters to populate a Settings object

type TemplateComponentWriter

type TemplateComponentWriter func(confDir string, pg *ProjectGenerator)

TemplateComponentWriter creates a skeleton Granitic component definition file in the supplied location

type TemplateConfigWriter

type TemplateConfigWriter func(confDir string, pg *ProjectGenerator)

TemplateConfigWriter creates a skeleton Granitic configuration file in the supplied location

Jump to

Keyboard shortcuts

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