Documentation
¶
Index ¶
- Variables
- func BuildTool(d *Descriptor) *cli.App
- func CliFunc(d *Descriptor, a Action) func(*cli.Context) error
- func GoImports(c *Context, target string) error
- func InstallTool(c *Context, name, source string) (string, error)
- func Start(d *Descriptor)
- type Action
- type Actions
- type BuildVars
- type Command
- type Commander
- type Context
- type Descriptor
- type DotEnv
- type EnvLoader
- type Environment
- type GoBuild
- type GoTest
- type LogHeader
- type Logger
- type MockCommand
- type MockCommandRunner
- type NewAction
- type RunBinary
- type Task
- type TaskNames
- type Tasker
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ProjectName of application. ProjectName string // ProjectVersion of application. ProjectVersion string )
only available in project scope as supplied when compile using typgo.GoBuild or ldflags
View Source
var ( // ProjectPkg only available in BuildTool scope. The BuildTool must be compiled by wrapper. ProjectPkg string // TypicalTmp only available in BuildTool scope. The BuildTool must be compiled by wrapper. TypicalTmp string )
only available in build-tool scope
View Source
var ColorSet = struct { Project color.Attribute Task color.Attribute Command color.Attribute Warn color.Attribute }{ Project: color.FgHiCyan, Task: color.FgCyan, Command: color.FgGreen, Warn: color.FgYellow, }
ColorSet color set
Functions ¶
func CliFunc ¶
func CliFunc(d *Descriptor, a Action) func(*cli.Context) error
CliFunc return urfave cli function from Action
func InstallTool ¶
InstallTool install tool to typical-tmp folder
Types ¶
type Command ¶
type Command struct {
Name string
Args []string
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
Dir string
Env []string
}
Command is wrapper to exec.Command
type Context ¶
type Context struct {
*cli.Context
Logger
Descriptor *Descriptor
// contains filtered or unexported fields
}
Context related with build task
func NewContext ¶
func NewContext(c *cli.Context, d *Descriptor) *Context
NewContext return instance of context
func (*Context) ExecuteCommand ¶
ExecuteCommand execute a command
func (*Context) ExecuteCommandLine ¶
ExecuteCommandLine execute bash command
type Descriptor ¶
type Descriptor struct {
ProjectName string // By default, is same with project folder. Only allowed characters(a-z,A-Z), underscore or dash.
ProjectVersion string // By default, it is 0.0.1
Environment EnvLoader
Tasks []Tasker
Stdout io.Writer
}
Descriptor describe the project
type Environment ¶
Environment variable
type GoBuild ¶
type GoBuild struct {
MainPackage string // By default, is "cmd/PROJECT_NAME"
Output string // By default, is "bin/PROJECT_NAME"
// By default is set variable typgo.ProjectName to PROJECT_NAME
// and typgo.ProjectVersion to PROJECT-VERSION
Ldflags fmt.Stringer
}
GoBuild command
type GoTest ¶
type GoTest struct {
Timeout time.Duration
NoCover bool
Verbose bool
Includes []string
Excludes []string
}
GoTest command test
type LogHeader ¶
func LogHeaders ¶
type MockCommand ¶
type MockCommand struct {
CommandLine string
OutputBytes []byte
ErrorBytes []byte
ReturnError error
}
MockCommand is the test expectation
type MockCommandRunner ¶
type MockCommandRunner struct {
Mocks []*MockCommand
Ptr int
}
MockCommandRunner mocking bash
func (*MockCommandRunner) Expectation ¶
func (r *MockCommandRunner) Expectation() *MockCommand
Expectation for bash
type Task ¶
type Task struct {
Name string
Aliases []string
Usage string
Flags []cli.Flag
SkipFlagParsing bool
Action Action
Before Action
SubTasks []*Task
}
Task to run action
func (*Task) CliCommand ¶
func (t *Task) CliCommand(d *Descriptor) *cli.Command
CliCommand return cli command from task
Click to show internal directories.
Click to hide internal directories.