command

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CMD         = "cmd"
	DESCRIPTION = "description"
	ENV         = "env"
	EvalEnv     = "eval_env"
	OPTIONS     = "options"
	DEPENDS     = "depends"
	CHECKSUM    = "checksum"
)
View Source
var DocoptParser = &docopt.Parser{
	HelpHandler:   docopt.NoHelpHandler,
	OptionsFirst:  false,
	SkipHelpFlags: false,
}

Functions

func EvalEnvVariable

func EvalEnvVariable(rawCmd string) (string, error)

eval env value and trim result string TODO pass env from cfg.env - it will allow to use static env in eval_env TODO maybe use cfg.Shell instead of sh

func OptsToLetsCli

func OptsToLetsCli(opts docopt.Opts) map[string]string

func OptsToLetsOpt

func OptsToLetsOpt(opts docopt.Opts) map[string]string

func ParseAndValidateCommand

func ParseAndValidateCommand(newCmd *Command, rawCommand map[interface{}]interface{}) error

ParseAndValidateCommand parses and validates unmarshaled yaml

func ParseDocopts

func ParseDocopts(cmd Command) (docopt.Opts, error)

ParseDocopts parses docopts for command options with args from os.Args TODO pass os.Argv explicitly

Types

type Command

type Command struct {
	Name        string
	Cmd         string
	Description string
	Env         map[string]string
	RawOptions  string
	Options     map[string]string
	CliOptions  map[string]string
	Depends     []string
	Checksum    string
	ChecksumMap map[string]string
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(name string) Command

NewCommand creates new command struct

func (*Command) ChecksumCalculator

func (cmd *Command) ChecksumCalculator() error

type ParseCommandError

type ParseCommandError struct {
	Path struct {
		Full  string
		Field string
	}
	Err error
}

func (*ParseCommandError) Error

func (e *ParseCommandError) Error() string

Jump to

Keyboard shortcuts

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