Documentation
¶
Index ¶
- Constants
- func Args(words []*syntax.Word) ([]string, bool)
- func BraceArgs(words []*syntax.Word) ([]string, bool)
- func CommandName(name string) string
- func CommandWord(words []string) (int, bool)
- func EnvArgs(args []*syntax.Word) ([]*syntax.Word, string)
- func ExecutableWord(words []*syntax.Word) (int, bool)
- func FilePath(directory, path string) string
- func Heredoc(redirect *syntax.Redirect, partial bool) (string, bool)
- func InterpreterIdentity(interpreter string) string
- func IsBatch(input string) bool
- func IsDigits(value string) bool
- func Literal(word *syntax.Word) (string, bool)
- func LiteralCd(stmt *syntax.Stmt, directory string) (string, bool)
- func LiteralParts(parts []syntax.WordPart, quoted bool) bool
- func Operand(word *syntax.Word) (value string, glob bool, ok bool)
- func PatternCall(script string, statement *syntax.Stmt) ([]string, bool)
- func PatternWord(word *syntax.Word) bool
- func Sequence(statements []*syntax.Stmt) []*syntax.Stmt
- func ShellErrexit(statement *syntax.Stmt) (bool, bool)
- func ShellOptions(statement *syntax.Stmt) bool
- func ShellScript(statement *syntax.Stmt) (string, bool)
- func Split(input string) ([]string, error)
- func SplitSource(input string) []string
- func StatementSource(stmt *syntax.Stmt, fallback string) string
- func StaticWord(word *syntax.Word) (string, bool)
- func StreamingStatements(input, directory string) ([]*syntax.Stmt, string, bool, bool)
- func UnwrapEnv(statement *syntax.Stmt) *syntax.Stmt
- func UnwrapMRun(statement *syntax.Stmt) *syntax.Stmt
- func UnwrapTimeout(statement *syntax.Stmt) *syntax.Stmt
- type HeaderError
- type Parsed
Constants ¶
const Dynamic = "\x00"
Dynamic marks a shell word whose value is known only at runtime.
Variables ¶
This section is empty.
Functions ¶
func BraceArgs ¶
BraceArgs expands bounded lexical braces before reading static arguments. It never resolves parameters, expands filesystem globs, or executes source. Source: libraries/commandanalysis/execscope/shell.go:1007:1028@2f371767.
func CommandName ¶
CommandName normalizes absolute executable paths without treating relative paths as known executables.
func CommandWord ¶
CommandWord shares wrapper operand handling with embedded-script classification.
func ExecutableWord ¶
ExecutableWord follows wrappers without confusing option operands with the command. Lookup-only command invocations stay unchanged.
func InterpreterIdentity ¶
InterpreterIdentity normalizes an interpreter path for policy comparisons.
func LiteralCd ¶
LiteralCd returns the directory a literal `cd` selects for later steps. Home-relative, previous-directory, and computed targets do not match.
func PatternCall ¶
PatternCall returns unevaluated arguments from a simple foreground command. An empty source requires literal arguments; otherwise simple shell patterns and parameters retain their original spelling. Transparent env and timeout wrappers are removed from the copy, never from the executed source.
func PatternWord ¶
PatternWord recognizes shell patterns and simple parameter references without expanding them. Parameter operators and executable substitutions stay opaque.
func ShellErrexit ¶
ShellErrexit reports whether validated current-shell error options explicitly leave errexit enabled. Unspecified errexit is conservatively false.
func ShellOptions ¶
ShellOptions recognizes current-shell set options that neither change command resolution nor select a repository or directory. External wrappers stay opaque.
func ShellScript ¶
ShellScript recognizes a literal shell -c script without positional arguments or redirects. Recognition does not execute the script or resolve executables.
func Split ¶
Split starts programs at column-zero interpreter headers outside shell constructs. Headers stay with their programs; all other source bytes remain unchanged. Only an omitted params directive inherits the preceding complete object.
func SplitSource ¶
SplitSource returns authored program slices without validating headers or expanding inherited directives. It is also suitable for unfinished display input.
func StatementSource ¶
StatementSource prints a statement that owns a noncontiguous heredoc body. Other statements keep the caller's source slice and separator policy.
func StaticWord ¶
StaticWord only unquotes literal text. In particular, expand must never see parameter, arithmetic, command, process, or pathname expansions here.
func StreamingStatements ¶
StreamingStatements parses display-only stock command input. It never expands shell values or authorizes execution. Recovery is limited to the parser's incomplete final construct so streaming cat and interpreter heredocs can become visible before the host completes the call.
func UnwrapEnv ¶
UnwrapEnv removes command-resolution-preserving literal env arguments from a copied statement. Unsupported options, dynamic values and PATH changes stay intact.
func UnwrapMRun ¶
UnwrapMRun removes valid literal mrun options from a display copy. Child arguments and redirections remain intact; this does not establish execution.
Types ¶
type HeaderError ¶
HeaderError locates a rejected header in the submitted program. Line is one-based and counts CRLF as one line terminator, just like header parsing.
func (*HeaderError) Error ¶
func (e *HeaderError) Error() string
func (*HeaderError) Unwrap ¶
func (e *HeaderError) Unwrap() error