Documentation ¶
Overview ¶
Copyright © 2017 Platina Systems, Inc. All rights reserved. Use of this source code is governed by the GPL-2 license described in the LICENSE file.
Copyright © 2017 Platina Systems, Inc. All rights reserved. Use of this source code is governed by the GPL-2 license described in the LICENSE file.
Package shellutils provides services to parse shell-like input, produce an intermediate parse tree, and render the parse tree into string slices and a map of environment variables suitable for execution.
Index ¶
Constants ¶
const ( TokenLiteral = iota TokenEnvget TokenEnvset )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cmdline ¶
Cmdline is a slice of Words which may be variable setting, a command, or arguments to that command. There is a seperate terminator which is either a pipeline operator (|) or a list operator (; & || &&).
type List ¶
type List struct {
Cmds []Cmdline
}
List is a slice of pipelines. The pipelines were concatenated via unconditional execution operators (; and &) or conditional execution operators (|| and &&).
type Token ¶
Token is a type and a string value. During parsing, we convert string input into a series of tokens.
type Tokentype ¶
type Tokentype int
Tokentype defines the type of a token tokenLiteral is liternal string text. The string is the text of the word being assembled. tokenEnvget is a reference to an environment variable. The string is the environment variable name. Any punctuation (dollar, brace) has been stripped tokenEnvset is the operator to set an environment variable. The string is the assignment operator, i.e. =. This is represented as a token to prevent quoted = characters to be interpreted as setting environment variables