executor

package
v0.0.0-...-51a604f Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

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
⌂ 换网址