ast

package
v0.4.0-beta.15 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSpinnerName string = "Running..."

Variables

View Source
var KindConditionalEnd = goldast.NewNodeKind("ConditionalEnd")
View Source
var KindConditionalStart = goldast.NewNodeKind("ConditionalStart")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindDescriptionBlock = goldast.NewNodeKind("DescriptionBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindEnvironmentSubstitution = goldast.NewNodeKind("EnvironmentSubstitution")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindExecutionBlock = goldast.NewNodeKind("ExecutionBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindIgnoreBlock = goldast.NewNodeKind("IgnoreBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindImportBlock = goldast.NewNodeKind("ImportBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindInvisibleBlock = goldast.NewNodeKind("InvisibleBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindOnFailure = goldast.NewNodeKind("OnFailure")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindRundownBlock = goldast.NewNodeKind("RundownBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindSaveCodeBlock = goldast.NewNodeKind("SaveCodeBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindSectionEnd = goldast.NewNodeKind("SectionEnd")
View Source
var KindSectionOption = goldast.NewNodeKind("SectionOption")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindSectionPointer = goldast.NewNodeKind("SectionPointer")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindStopFail = goldast.NewNodeKind("StopFail")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindStopOk = goldast.NewNodeKind("StopOk")

KindRundownBlock is a NodeKind of the RundownBlock node.

View Source
var KindSubEnvBlock = goldast.NewNodeKind("SubEnvBlock")

KindRundownBlock is a NodeKind of the RundownBlock node.

Functions

func FindNode

func FindNode(parent gold_ast.Node, finder func(n gold_ast.Node) bool) gold_ast.Node

func PruneActions

func PruneActions(doc goldast.Node)

func PruneDocumentToRoot

func PruneDocumentToRoot(doc goldast.Node)

func PruneDocumentToSection

func PruneDocumentToSection(doc goldast.Node, sectionName string)

Reduces the document to just the requested section.

func PruneSectionFromNode

func PruneSectionFromNode(node goldast.Node)

Removes everything from the current node through to either SectionEnd or no more nodes.

Types

type Conditional

type Conditional interface {
	HasIfScript() bool
	GetIfScript() string
	SetIfScript(string)
	GetResult() bool
	SetResult(bool)
	HasResult() bool
}

type ConditionalEnd

type ConditionalEnd struct {
	goldast.BaseBlock
	Start *ConditionalStart
}

func (*ConditionalEnd) Dump

func (n *ConditionalEnd) Dump(source []byte, level int)

func (*ConditionalEnd) Kind

func (n *ConditionalEnd) Kind() goldast.NodeKind

Kind implements Node.Kind.

type ConditionalImpl

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

func (*ConditionalImpl) GetIfScript

func (n *ConditionalImpl) GetIfScript() string

func (*ConditionalImpl) GetResult

func (n *ConditionalImpl) GetResult() bool

func (*ConditionalImpl) HasIfScript

func (n *ConditionalImpl) HasIfScript() bool

func (*ConditionalImpl) HasResult

func (n *ConditionalImpl) HasResult() bool

func (*ConditionalImpl) SetIfScript

func (n *ConditionalImpl) SetIfScript(script string)

func (*ConditionalImpl) SetResult

func (n *ConditionalImpl) SetResult(result bool)

type ConditionalStart

type ConditionalStart struct {
	goldast.BaseBlock
	ConditionalImpl
	ID  string
	End *ConditionalEnd
}

func NewConditionalStart

func NewConditionalStart() *ConditionalStart

NewRundownBlock returns a new RundownBlock node.

func (*ConditionalStart) Dump

func (n *ConditionalStart) Dump(source []byte, level int)

func (*ConditionalStart) GetEndSkipNode

func (n *ConditionalStart) GetEndSkipNode(goldast.Node) goldast.Node

func (*ConditionalStart) Kind

func (n *ConditionalStart) Kind() goldast.NodeKind

Kind implements Node.Kind.

type DescriptionBlock

type DescriptionBlock struct {
	goldast.BaseBlock
}

func NewDescriptionBlock

func NewDescriptionBlock() *DescriptionBlock

NewRundownBlock returns a new RundownBlock node.

func (*DescriptionBlock) Dump

func (n *DescriptionBlock) Dump(source []byte, level int)

func (*DescriptionBlock) Kind

func (n *DescriptionBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type EnvironmentSubstitution

type EnvironmentSubstitution struct {
	goldast.String
}

func NewSubEnvInline

func NewSubEnvInline(contents string) *EnvironmentSubstitution

NewRundownBlock returns a new RundownBlock node.

func (*EnvironmentSubstitution) Dump

func (n *EnvironmentSubstitution) Dump(source []byte, level int)

func (*EnvironmentSubstitution) Kind

Kind implements Node.Kind.

type ExecutionBlock

type ExecutionBlock struct {
	goldast.BaseBlock
	CodeBlock *goldast.FencedCodeBlock

	ID                    string
	ShowStdout            bool
	ShowStderr            bool
	CaptureStdoutInto     string
	Reveal                bool
	Execute               bool
	CaptureEnvironment    []string
	SubstituteEnvironment bool
	SpinnerName           string
	SpinnerMode           SpinnerMode
	With                  string
	Language              string
	ReplaceProcess        bool
	SkipOnSuccess         bool
	SkipOnFailure         bool
}

func NewExecutionBlock

func NewExecutionBlock(fcb *goldast.FencedCodeBlock) *ExecutionBlock

NewRundownBlock returns a new RundownBlock node.

func (*ExecutionBlock) Dump

func (n *ExecutionBlock) Dump(source []byte, level int)

func (*ExecutionBlock) Kind

func (n *ExecutionBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type FarSkip

type FarSkip interface {
	GetEndSkipNode(gold_ast.Node) gold_ast.Node
}

type IgnoreBlock

type IgnoreBlock struct {
	goldast.BaseBlock
}

func NewIgnoreBlock

func NewIgnoreBlock() *IgnoreBlock

NewRundownBlock returns a new RundownBlock node.

func (*IgnoreBlock) Dump

func (n *IgnoreBlock) Dump(source []byte, level int)

func (*IgnoreBlock) Kind

func (n *IgnoreBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type ImportBlock

type ImportBlock struct {
	goldast.BaseBlock

	ImportPrefix string
}

The rundown import block expects to wrap a markdown link to the file to import.

For example: <r import="ci">[Our CI scripts](./ci/RUNDOWN.md)</r>

Will import our the ./ci/RUNDOWN.md file, namespacing all commands under the "ci:" prefix.

func NewImportBlock

func NewImportBlock() *ImportBlock

NewImportBlock returns a new RundownBlock node.

func ProcessImportBlocks

func ProcessImportBlocks(doc goldast.Node) []*ImportBlock

func (*ImportBlock) Dump

func (n *ImportBlock) Dump(source []byte, level int)

func (*ImportBlock) GetFilename

func (n *ImportBlock) GetFilename() string

func (*ImportBlock) IngestChildren

func (n *ImportBlock) IngestChildren(doc goldast.Node)

func (*ImportBlock) Kind

func (n *ImportBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type InvisibleBlock

type InvisibleBlock struct {
	goldast.BaseBlock

	ImportPrefix string
}

func NewInvisibleBlock

func NewInvisibleBlock() *InvisibleBlock

NewRundownBlock returns a new RundownBlock node.

func (*InvisibleBlock) Dump

func (n *InvisibleBlock) Dump(source []byte, level int)

func (*InvisibleBlock) Kind

func (n *InvisibleBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type OnFailure

type OnFailure struct {
	goldast.BaseBlock
	FailureMessageRegexp string
}

func GetOnFailureNodes

func GetOnFailureNodes(node goldast.Node) []*OnFailure

Searches the current node's section for OnFailure nodes and returns them.

func NewOnFailure

func NewOnFailure() *OnFailure

NewRundownBlock returns a new RundownBlock node.

func (*OnFailure) ConvertToParagraph

func (n *OnFailure) ConvertToParagraph() *goldast.Paragraph

func (*OnFailure) Dump

func (n *OnFailure) Dump(source []byte, level int)

func (*OnFailure) Kind

func (n *OnFailure) Kind() goldast.NodeKind

Kind implements Node.Kind.

func (*OnFailure) MatchesError

func (n *OnFailure) MatchesError(output []byte) bool

type OptionType

type OptionType interface {
	Validate(input string) error
	Normalise(input string) string
	Describe() string
}

func BuildOptionType

func BuildOptionType(optionType string) OptionType

type RundownBlock

type RundownBlock struct {
	goldast.BaseBlock
	TagName string
	Attrs   []html.Attribute
}

func NewRundownBlock

func NewRundownBlock() *RundownBlock

NewRundownBlock returns a new RundownBlock node.

func (*RundownBlock) Dump

func (n *RundownBlock) Dump(source []byte, level int)

Dump implements Node.Dump.

func (*RundownBlock) GetAttr

func (r *RundownBlock) GetAttr(name string) null.String

func (*RundownBlock) GetAttrList

func (r *RundownBlock) GetAttrList(name string) []string

func (*RundownBlock) GetFirstAttr

func (r *RundownBlock) GetFirstAttr(names ...string) null.String

func (*RundownBlock) HasAttr

func (r *RundownBlock) HasAttr(names ...string) bool

func (*RundownBlock) Kind

func (n *RundownBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type SaveCodeBlock

type SaveCodeBlock struct {
	goldast.BaseBlock
	CodeBlock *goldast.FencedCodeBlock

	Reveal         bool
	SaveToVariable string
	Replacements   map[string]string
}

func NewSaveCodeBlock

func NewSaveCodeBlock(fcb *goldast.FencedCodeBlock, saveToVariable string) *SaveCodeBlock

NewRundownBlock returns a new RundownBlock node.

func (*SaveCodeBlock) Dump

func (n *SaveCodeBlock) Dump(source []byte, level int)

func (*SaveCodeBlock) Kind

func (n *SaveCodeBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type SectionEnd

type SectionEnd struct {
	goldast.BaseBlock
	SectionPointer *SectionPointer
}

func (*SectionEnd) Dump

func (n *SectionEnd) Dump(source []byte, level int)

func (*SectionEnd) Kind

func (n *SectionEnd) Kind() goldast.NodeKind

Kind implements Node.Kind.

type SectionOption

type SectionOption struct {
	goldast.BaseInline
	OptionName        string
	OptionType        OptionType
	OptionTypeString  string
	OptionDescription string
	OptionPrompt      null.String
	OptionDefault     null.String
	OptionRequired    bool
	OptionAs          string
}

func NewSectionOption

func NewSectionOption(name string) *SectionOption

NewRundownBlock returns a new RundownBlock node.

func (*SectionOption) Dump

func (n *SectionOption) Dump(source []byte, level int)

func (*SectionOption) Kind

func (n *SectionOption) Kind() goldast.NodeKind

Kind implements Node.Kind.

type SectionPointer

type SectionPointer struct {
	goldast.BaseBlock
	ConditionalImpl

	SectionName      string
	StartNode        goldast.Node
	Options          []*SectionOption
	DescriptionShort string
	DescriptionLong  *DescriptionBlock
	End              *SectionEnd
}

func FindSectionInDocument

func FindSectionInDocument(parent goldast.Node, name string) *SectionPointer

func GetSectionForNode

func GetSectionForNode(node goldast.Node) *SectionPointer

func GetSections

func GetSections(doc goldast.Node) []*SectionPointer

func NewSectionPointer

func NewSectionPointer(name string) *SectionPointer

NewRundownBlock returns a new RundownBlock node.

func (*SectionPointer) AddOption

func (n *SectionPointer) AddOption(option *SectionOption)

func (*SectionPointer) Dump

func (n *SectionPointer) Dump(source []byte, level int)

func (*SectionPointer) GetEndSkipNode

func (n *SectionPointer) GetEndSkipNode(node goldast.Node) goldast.Node

func (*SectionPointer) Kind

func (n *SectionPointer) Kind() goldast.NodeKind

Kind implements Node.Kind.

type SpinnerMode

type SpinnerMode int
const (
	SpinnerModeVisible SpinnerMode = iota
	SpinnerModeHidden
	SpinnerModeInlineAll
	SpinnerModeInlineFirst
)

type StopFail

type StopFail struct {
	goldast.BaseBlock
	ConditionalImpl
}

func NewStopFail

func NewStopFail() *StopFail

NewRundownBlock returns a new RundownBlock node.

func (*StopFail) Dump

func (n *StopFail) Dump(source []byte, level int)

func (*StopFail) Kind

func (n *StopFail) Kind() goldast.NodeKind

Kind implements Node.Kind.

type StopOk

type StopOk struct {
	goldast.BaseBlock
	ConditionalImpl
}

func NewStopOk

func NewStopOk() *StopOk

NewRundownBlock returns a new RundownBlock node.

func (*StopOk) Dump

func (n *StopOk) Dump(source []byte, level int)

func (*StopOk) Kind

func (n *StopOk) Kind() goldast.NodeKind

Kind implements Node.Kind.

type SubEnvBlock

type SubEnvBlock struct {
	goldast.BaseBlock

	InnerBlock goldast.Node
}

func NewSubEnvBlock

func NewSubEnvBlock(innerBlock goldast.Node) *SubEnvBlock

NewRundownBlock returns a new RundownBlock node.

func (*SubEnvBlock) Dump

func (n *SubEnvBlock) Dump(source []byte, level int)

func (*SubEnvBlock) Kind

func (n *SubEnvBlock) Kind() goldast.NodeKind

Kind implements Node.Kind.

type TypeBoolean

type TypeBoolean struct{}

func (*TypeBoolean) Describe

func (t *TypeBoolean) Describe() string

func (*TypeBoolean) Normalise

func (t *TypeBoolean) Normalise(input string) string

func (*TypeBoolean) Validate

func (t *TypeBoolean) Validate(string) error

type TypeEnum

type TypeEnum struct {
	ValidValues []string
}

func (*TypeEnum) Describe

func (t *TypeEnum) Describe() string

func (*TypeEnum) Normalise

func (t *TypeEnum) Normalise(string) string

func (*TypeEnum) Validate

func (t *TypeEnum) Validate(input string) error

type TypeFilename

type TypeFilename struct {
	MustExist    bool
	MustNotExist bool
}

func (*TypeFilename) Describe

func (t *TypeFilename) Describe() string

func (*TypeFilename) Normalise

func (t *TypeFilename) Normalise(input string) string

func (*TypeFilename) Validate

func (t *TypeFilename) Validate(string) error

type TypeString

type TypeString struct{}

func (*TypeString) Describe

func (t *TypeString) Describe() string

func (*TypeString) Normalise

func (t *TypeString) Normalise(string) string

func (*TypeString) Validate

func (t *TypeString) Validate(string) error

Jump to

Keyboard shortcuts

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