Documentation ¶
Index ¶
- Constants
- Variables
- func Copy(src, dest string) error
- func CopyDir(srcPath, destPath string, filters ...func(filePath string) bool) error
- func CopyPkg(globalGoPath, pkg, dstPath string, includeTest bool) error
- func Error(a ...interface{})
- func Errorf(format string, a ...interface{})
- func Home() (string, error)
- func IsDir(dir string) bool
- func IsExist(path string) bool
- func IsGoRepoPath(importPath string) bool
- func Printf(format string, a ...interface{})
- func Println(a ...interface{})
- func StatDir(rootPath string, includeDir ...bool) ([]string, error)
- type Command
- func (c *Command) AddArguments(args ...string) *Command
- func (c *Command) Run() (string, error)
- func (c *Command) RunInDir(dir string) (string, error)
- func (c *Command) RunInDirBytes(dir string) ([]byte, error)
- func (c *Command) RunInDirPipeline(dir string, stdout, stderr io.Writer) error
- func (c *Command) RunInDirTimeout(timeout time.Duration, dir string) ([]byte, error)
- func (c *Command) RunInDirTimeoutPipeline(timeout time.Duration, dir string, stdout, stderr io.Writer) error
- func (c *Command) RunTimeout(timeout time.Duration) (string, error)
- func (c *Command) String() string
- type ConcatenateError
- type Config
- type ErrExecTimeout
- type GlobalConfig
- type Pkg
- type PkgType
- type Source
- type Target
Constants ¶
const ( PkgTypeUnknown = iota // 0 PkgTypeGoRoot // 1 PkgTypeGloablGoPath // 2 PkgTypeProjectGoPath // 3 PkgTypeProjectVendor // 4 )
Variables ¶
var CmdAdd = cli.Command{ Name: "add", Usage: "Add one or more new dependency packages", Description: `Add one or more new dependency packages`, Action: runAdd, Flags: []cli.Flag{ cli.BoolFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, cli.BoolFlag{ Name: "test, t", Usage: "include test files", }, cli.StringFlag{ Name: "tags", Usage: "tags for import package find", }, }, }
CmdAdd represents add a new dependency package and it's dependencies to this project
var CmdBuild = cli.Command{ Name: "build", Usage: "Build the target", Description: `Build the target`, Action: runBuild, SkipFlagParsing: true, }
CmdBuild represents
var CmdConfig = cli.Command{ Name: "config", Usage: "Config global options", Description: `Config global options`, Subcommands: []cli.Command{ { Name: "get", Usage: "Get global config options", Description: `Get global config options`, Action: runConfigGet, Flags: []cli.Flag{ cli.BoolFlag{ Name: "all, a", Usage: "Show all the config options", }, }, }, { Name: "set", Usage: "Set global config options", Description: `Set global config options`, Action: runConfigSet, }, }, Flags: []cli.Flag{ cli.BoolFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, }, }
CmdConfig represents config the gop global options
var CmdDownload = cli.Command{ Name: "dl", Usage: "Download one or more packages", Description: `Download one or more packages`, Action: runDownload, Flags: []cli.Flag{ cli.BoolFlag{ Name: "override, o", Usage: "Download packages even it exists.", }, cli.BoolFlag{ Name: "recursive, r", Usage: "Also download all the dependent packages", }, cli.StringFlag{ Name: "source, s", Usage: "Download source", }, cli.StringFlag{ Name: "target, t", Usage: "Download target directory", }, cli.BoolFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, }, }
CmdDownload represents download a package from github or gopm.io
var CmdEnsure = cli.Command{ Name: "ensure", Usage: "Ensure all the dependent packages installed accroding target", Description: `Ensure all the dependent packages installed accroding target`, Action: runEnsure, Flags: []cli.Flag{ cli.BoolFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, cli.BoolFlag{ Name: "dry, d", Usage: "Dry run, print what would be done", }, cli.BoolFlag{ Name: "get, g", Usage: "call go get to download the package if package is not in GOPATH", }, cli.BoolFlag{ Name: "update, u", Usage: "call go get -u to update the package if package is exist in GOPATH", }, cli.BoolFlag{ Name: "test, t", Usage: "include test files", }, cli.StringFlag{ Name: "tags", Usage: "tags for import package find", }, }, }
CmdEnsure represents
var CmdInit = cli.Command{ Name: "init", Usage: "Init a new project", Description: `Init a new project`, Action: runInit, Flags: []cli.Flag{ cli.BoolTFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, cli.StringFlag{ Name: "editor, e", Usage: "Generate specifial editor configuration. Could be vscode or blank with no editor support", }, }, }
CmdInit represents
var CmdRelease = cli.Command{ Name: "release", Usage: "Release the target according the gop.yml", Description: `Release the target according the gop.yml`, Action: runRelease, SkipFlagParsing: true, }
CmdRelease represents
var CmdRemove = cli.Command{ Name: "rm", Usage: "Remove one or more dependent packages", Description: `Remove one or more dependent packages`, Action: runRemove, Flags: []cli.Flag{ cli.BoolFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, }, }
CmdRemove represents
var CmdRun = cli.Command{ Name: "run", Usage: "Run the target and monitor the source file changes", Description: `Run the target and monitor the source file changes`, Action: runRun, SkipFlagParsing: true, }
CmdRun represents
var CmdStatus = cli.Command{ Name: "status", Usage: "List the target's dependent packages", Description: `List the target's dependent packages`, Action: runStatus, Flags: []cli.Flag{ cli.BoolFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, cli.BoolFlag{ Name: "test, t", Usage: "include test files", }, cli.StringFlag{ Name: "tags", Usage: "tags for import package find", }, }, }
CmdStatus represents
var CmdTest = cli.Command{ Name: "test", Usage: "Run the target test codes", Description: `Run the target test codes`, Action: runTest, SkipFlagParsing: true, }
CmdTest represents
var CmdUpdate = cli.Command{ Name: "update", Usage: "Update spcified vendor packages", Description: `Update spcified vendor packages`, Action: runUpdate, Flags: []cli.Flag{ cli.BoolFlag{ Name: "verbose, v", Usage: "Enables verbose progress and debug output", }, cli.BoolFlag{ Name: "test, t", Usage: "include test files", }, cli.StringFlag{ Name: "tags", Usage: "tags for import package find", }, cli.BoolFlag{ Name: "full, f", Usage: "if update all dependent packages, default only missing packages", }, }, }
CmdUpdate represents update a new dependency package and it's dependencies to this project
var CmdVet = cli.Command{ Name: "vet", Usage: "Vet", Description: `Vet`, Action: runVet, SkipFlagParsing: true, }
CmdVet represents a vet command
var ( // Debug indicated whether it is debug mode Debug = false )
var (
ErrNotSupported = errors.New("The package path is not supported")
)
var ( // GlobalCommandArgs global command args for external package setting GlobalCommandArgs []string )
var (
GlobalEnvs []string
)
Functions ¶
func CopyDir ¶
CopyDir copy files recursively from source to target directory.
The filter accepts a function that process the path info. and should return true for need to filter.
It returns error when error occurs in underlying functions.
func Errorf ¶
func Errorf(format string, a ...interface{})
Errorf printf content as an error information
func Home ¶
Home returns the home directory for the executing user.
This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected.
func IsDir ¶
IsDir returns true if given path is a directory, or returns false when it's a file or does not exist.
func IsExist ¶
IsExist checks whether a file or directory exists. It returns false when the file or directory does not exist.
func IsGoRepoPath ¶
IsGoRepoPath returns true if package is from standard library.
func StatDir ¶
StatDir gathers information of given directory by depth-first. It returns slice of file list and includes subdirectories if enabled; it returns error and nil slice when error occurs in underlying functions, or given path is not a directory or does not exist.
Slice does not include given path itself. If subdirectories is enabled, they will have suffix '/'.
Types ¶
type Command ¶
type Command struct { Env []string // contains filtered or unexported fields }
Command represents a command with its subcommands or arguments.
func NewCommand ¶
NewCommand creates and returns a new Git Command based on given command and arguments.
func (*Command) AddArguments ¶
AddArguments adds new argument(s) to the command.
func (*Command) Run ¶
Run executes the command in default working directory and returns stdout in string and error (combined with stderr).
func (*Command) RunInDir ¶
RunInDir executes the command in given directory and returns stdout in string and error (combined with stderr).
func (*Command) RunInDirBytes ¶
RunInDirBytes executes the command in given directory and returns stdout in []byte and error (combined with stderr).
func (*Command) RunInDirPipeline ¶
RunInDirPipeline executes the command in given directory, it pipes stdout and stderr to given io.Writer.
func (*Command) RunInDirTimeout ¶
RunInDirTimeout executes the command in given directory with given timeout, and returns stdout in []byte and error (combined with stderr).
func (*Command) RunInDirTimeoutPipeline ¶
func (c *Command) RunInDirTimeoutPipeline(timeout time.Duration, dir string, stdout, stderr io.Writer) error
RunInDirTimeoutPipeline executes the command in given directory with given timeout, it pipes stdout and stderr to given io.Writer.
func (*Command) RunTimeout ¶
RunTimeout executes the command in default working directory with given timeout, and returns stdout in string and error (combined with stderr).
type ConcatenateError ¶
ConcatenateError describes the error of concate
func (ConcatenateError) Error ¶
func (e ConcatenateError) Error() string
Error implement error interface
type ErrExecTimeout ¶
ErrExecTimeout error of executing timed out
func (ErrExecTimeout) Error ¶
func (e ErrExecTimeout) Error() string
Error implement error interface
type GlobalConfig ¶
type GlobalConfig struct { Init struct { DefaultEditor string `yaml:"default_editor"` } `yaml:"init"` Repos struct { DefaultDir string `yaml:"default_dir"` } `yaml:"repos"` Sources map[string]Source `yaml:"sources"` }
func (*GlobalConfig) Get ¶
func (g *GlobalConfig) Get(key string) string
func (*GlobalConfig) Set ¶
func (g *GlobalConfig) Set(key, value string)