monobrew

package
v0.0.0-...-8a15cb1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopLevel int = iota
	DefiningBlock
	DefiningScript
	DefiningStdin
	DefiningVar
)

Variables

This section is empty.

Functions

func ExecuteCommand

func ExecuteCommand(stdin string, command string, args []string) (exitCode int, output string, error string)

func ExecuteOp

func ExecuteOp(op *Block)

func PanicIfErr

func PanicIfErr(e error)

func PanicMsg

func PanicMsg(msg string)

func WarnMsg

func WarnMsg(msg string)

Types

type Block

type Block struct {
	Touched          bool          `json:"-"`
	Label            string        `json:"label"`
	OpCounter        uint          `json:"opCounter"`
	Command          string        `json:"command"`
	CommandPath      string        `json:"commandPath"`
	Args             []string      `json:"args"`
	Stdin            string        `json:"stdin"`
	Success          bool          `json:"success"`
	ExitCode         int           `json:"exitCode"`
	HaltIfFail       bool          `json:"haltIfFail"`
	StartTime        time.Time     `json:"startTime"`
	EndTime          time.Time     `json:"endTime"`
	ElapsedTime      time.Duration `json:"-"`
	RunError         string        `json:"runError"`
	StdouterrIsEmpty bool          `json:"outputIsEmpty"`
	Stdouterr        string        `json:"-"`
	StdouterrFile    string        `json:"outputFile"`
}

func CmdBlock

func CmdBlock(label string, command string) *Block

func (*Block) MarshalJSON

func (b *Block) MarshalJSON() ([]byte, error)

type Config

type Config struct {
	StateDir       string
	ConfigFiles    []string
	ConfigExpanded string

	Blocks []*Block
	Status map[string]string

	PrintVerboseResult  bool
	PrintDebug          bool
	NukeStateDirAtStart bool

	Parser  *Parser
	Scanner *Scanner
}

func NewConfig

func NewConfig() *Config

func (*Config) AddCmdBlock

func (c *Config) AddCmdBlock(name string, command string)

func (*Config) EnsureEnv

func (c *Config) EnsureEnv()

func (*Config) GetStatusKey

func (c *Config) GetStatusKey(key string) string

func (*Config) Load

func (c *Config) Load()

func (*Config) OrderedOps

func (c *Config) OrderedOps() []*Block

func (*Config) SetStatusKey

func (c *Config) SetStatusKey(key string, value string)

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(config *Config) *Parser

func (*Parser) AppendConfigToExpanded

func (p *Parser) AppendConfigToExpanded(configpath string)

func (*Parser) ExpandConfigs

func (p *Parser) ExpandConfigs()

func (*Parser) GetConfigContents

func (p *Parser) GetConfigContents(path string) string

func (*Parser) GetFileContents

func (p *Parser) GetFileContents(filepath string) string

func (*Parser) GetUrlContents

func (p *Parser) GetUrlContents(url string) string

func (*Parser) ParseConfig

func (p *Parser) ParseConfig(body string)

func (*Parser) ParseConfigReader

func (p *Parser) ParseConfigReader(body io.Reader)

This is an intentionally hacky, hard-coded parser. Replace as codebase and syntax stabilizes.

func (*Parser) ParseFilepath

func (p *Parser) ParseFilepath(filepath string)

func (*Parser) StartBlock

func (p *Parser) StartBlock(linebytes []byte)

func (*Parser) StoreBlock

func (p *Parser) StoreBlock()

type Runner

type Runner struct {
	Config    *Config
	OpCounter uint
}

func NewRunner

func NewRunner(config *Config) *Runner

func (*Runner) DumpState

func (r *Runner) DumpState(block *Block)

func (*Runner) RunOps

func (r *Runner) RunOps()

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(config *Config) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan()

func (*Scanner) ScanEtcIssue

func (s *Scanner) ScanEtcIssue()

func (*Scanner) UpdateStatus

func (s *Scanner) UpdateStatus(key string, value string)

Jump to

Keyboard shortcuts

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