gb: github.com/constabulary/gb/cmd Index | Files | Directories

package cmd

import "github.com/constabulary/gb/cmd"

Package command holds support functions and types for writing gb and gb plugins

Index

Package Files

cmd.go env.go path.go

func FindProjectroot Uses

func FindProjectroot(path string) (string, error)

FindProjectroot works upwards from path seaching for the src/ directory which identifies the project root.

func MergeEnv Uses

func MergeEnv(env []string, args map[string]string) []string

MergeEnv merges args into env, overwriting entries.

func MustGetwd Uses

func MustGetwd() string

MustGetwd returns current working directory and fails otherwise

func NewContext Uses

func NewContext(projectroot string, options ...func(*gb.Context) error) (*gb.Context, error)

NewContext creates a gb.Context for the project root.

func RunCommand Uses

func RunCommand(fs *flag.FlagSet, cmd *Command, projectroot, goroot string, args []string) error

RunCommand detects the project root, parses flags and runs the Command.

type Command Uses

type Command struct {
    // Name of the command
    Name string

    // UsageLine demonstrates how to use this command
    UsageLine string

    // Single line description of the purpose of the command
    Short string

    // Description of this command
    Long string

    // Run is invoked with a Context derived from the Project and arguments
    // left over after flag parsing.
    Run func(ctx *gb.Context, args []string) error

    // AddFlags installs additional flags to be parsed before Run.
    AddFlags func(fs *flag.FlagSet)

    // Allow plugins to modify arguments
    FlagParse func(fs *flag.FlagSet, args []string) error

    // SkipParseArgs avoids parsing arguments as import paths.
    SkipParseArgs bool
}

Command represents a subcommand, or plugin that is executed within a gb project.

func (*Command) Hidden Uses

func (c *Command) Hidden() bool

Hidden indicates this is a command which is hidden from help / alldoc.go.

func (*Command) Runnable Uses

func (c *Command) Runnable() bool

Runnable indicates this is a command that can be involved. Non runnable commands are only informational.

Directories

PathSynopsis
gbgb, a project based build tool for the Go programming language.
gb/internal/match
gb-vendorgb-vendor, a gb plugin to manage your vendored dependencies.

Package cmd imports 8 packages (graph) and is imported by 4 packages. Updated 2017-05-14. Refresh now. Tools for package owners.