command

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultChecksumName = "lets_default_checksum"

Variables

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

Functions

func ChecksumForCmdPersisted added in v0.0.20

func ChecksumForCmdPersisted(cmd Command) bool

ChecksumForCmdPersisted checks if checksums for cmd exists and persisted

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

func PersistCommandsChecksumToDisk added in v0.0.20

func PersistCommandsChecksumToDisk(cmd Command) error

func ReadChecksumsFromDisk added in v0.0.20

func ReadChecksumsFromDisk(cmd Command) (map[string]string, error)

ReadChecksumsFromDisk reads all checksums for cmd into map

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
	PersistChecksum bool
	// 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 {
	Name string
	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