engine

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteCodeBlockAsync added in v0.1.0

func ExecuteCodeBlockAsync(codeBlock parsers.CodeBlock, env map[string]string) tea.Cmd

Executes a bash command and returns a tea message with the output. This function will be executed asycnhronously.

func ExecuteCodeBlockSync added in v0.1.0

func ExecuteCodeBlockSync(codeBlock parsers.CodeBlock, env map[string]string) tea.Msg

Executes a bash command syncrhonously. This function will block until the command finishes executing.

Types

type AzureStatusUpdatedMessage added in v0.1.0

type AzureStatusUpdatedMessage struct{}

Empty struct used to indicate that the azure status has been updated so that we can respond to it within the Update() function.

type CodeBlockState added in v0.1.0

type CodeBlockState struct {
	CodeBlock       parsers.CodeBlock
	CodeBlockNumber int
	Error           error
	StdErr          string
	StdOut          string
	StepName        string
	StepNumber      int
	Success         bool
}

State for the codeblock in interactive mode. Used to keep track of the state of each codeblock.

type Engine

type Engine struct {
	Configuration EngineConfiguration
}

func NewEngine

func NewEngine(configuration EngineConfiguration) (*Engine, error)

/ Create a new engine instance.

func (*Engine) ExecuteAndRenderSteps

func (e *Engine) ExecuteAndRenderSteps(steps []Step, env map[string]string) error

Executes the steps from a scenario and renders the output to the terminal.

func (*Engine) ExecuteScenario

func (e *Engine) ExecuteScenario(scenario *Scenario) error

Executes a deployment scenario.

func (*Engine) InteractWithScenario added in v0.1.0

func (e *Engine) InteractWithScenario(scenario *Scenario) error

Executes a Scenario in interactive mode. This mode goes over each codeblock step by step and allows the user to interact with the codeblock.

func (*Engine) TestScenario

func (e *Engine) TestScenario(scenario *Scenario) error

Validates a deployment scenario.

func (*Engine) TestSteps

func (e *Engine) TestSteps(steps []Step, env map[string]string) error

type EngineConfiguration

type EngineConfiguration struct {
	Verbose          bool
	DoNotDelete      bool
	CorrelationId    string
	Subscription     string
	Environment      string
	WorkingDirectory string
	RenderValues     bool
}

Configuration for the engine.

type FailedCommandMessage added in v0.1.0

type FailedCommandMessage struct {
	StdOut string
	StdErr string
	Error  error
}

Emitted when a command has failed to execute.

type InteractiveModeCommands added in v0.1.0

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

type InteractiveModeModel added in v0.1.0

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

func NewInteractiveModeModel added in v0.1.0

func NewInteractiveModeModel(
	title string,
	engine *Engine,
	steps []Step,
	env map[string]string,
) (InteractiveModeModel, error)

Create a new interactive mode model.

func (InteractiveModeModel) Init added in v0.1.0

func (model InteractiveModeModel) Init() tea.Cmd

Initialize the intractive mode model

func (InteractiveModeModel) Update added in v0.1.0

func (model InteractiveModeModel) Update(message tea.Msg) (tea.Model, tea.Cmd)

Updates the intractive mode model

func (InteractiveModeModel) View added in v0.1.0

func (model InteractiveModeModel) View() string

Renders the interactive mode model.

type Scenario

type Scenario struct {
	Name        string
	MarkdownAst ast.Node
	Steps       []Step
	Environment map[string]string
}

Scenarios are the top-level object that represents a scenario to be executed.

func CreateScenarioFromMarkdown

func CreateScenarioFromMarkdown(
	path string,
	languagesToExecute []string,
	environmentVariableOverrides map[string]string,
) (*Scenario, error)

Creates a scenario object from a given markdown file. languagesToExecute is used to filter out code blocks that should not be parsed out of the markdown file.

func (*Scenario) ToShellScript

func (s *Scenario) ToShellScript() string

Convert a scenario into a shell script

type Step

type Step struct {
	Name       string
	CodeBlocks []parsers.CodeBlock
}

Individual steps within a scenario.

type SuccessfulCommandMessage added in v0.1.0

type SuccessfulCommandMessage struct {
	StdOut string
	StdErr string
}

Emitted when a command has been executed successfully.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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