executor

package
v0.0.0-...-93250b7 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MimePlainText = "text/plain"
)

Variables

This section is empty.

Functions

func NewTokenAction

func NewTokenAction(t TokenType) lexmachine.Action

NewTokenAction creates a lexmachine action for the given tokentype

Types

type BashishParser

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

BashishParser is a parser for the bashish language. Bashish is a language that is a very simple subset of bash. It is basically shell commands plus the ability to do things like pipe the output of one command to another.

func NewBashishParser

func NewBashishParser() (*BashishParser, error)

NewBashishParser creates a new parser for the bashish language.

func (*BashishParser) Parse

func (p *BashishParser) Parse(doc string) ([]Instruction, error)

Parse a multline string into a sequence of commands

type Executor

type Executor struct {
	v1alpha1.UnimplementedExecuteServiceServer
	// contains filtered or unexported fields
}

Executor is responsible for executing the commands

func NewExecutor

func NewExecutor() (*Executor, error)

func (*Executor) Execute

type Instruction

type Instruction struct {
	Command *cmd.Cmd

	// Piped should be set to true if the output of this command should be piped to the next instruction.
	Piped bool
}

Instruction represents one instruction in the bashish language. This is typically a command that should be executed. In addition it contains information about how that command should be executed; e.g. if the output of this command should be piped to the next command.

type Token

type Token struct {
	TokenType TokenType
	Lexeme    string
	Match     *machines.Match
}

func NewToken

func NewToken(tokenType TokenType, m *machines.Match) *Token

type TokenType

type TokenType string
const (
	PipeToken       TokenType = "PIPE"
	QuoteToken      TokenType = "QUOTE"
	UnmatchedToken  TokenType = "UNMATCHED"
	TextToken       TokenType = "TEXT"
	WhiteSpaceToken TokenType = "WHITESPACE"
)

Jump to

Keyboard shortcuts

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