command

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package command parses a raw command line into argv tokens, detecting unquoted shell operators without interpreting them.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnterminatedQuote = errors.New("unterminated quote")

ErrUnterminatedQuote is returned by Parse when a quote is never closed.

Functions

This section is empty.

Types

type Command

type Command struct {
	Raw         string   // original input, verbatim
	Args        []string // argv tokens, quotes/escapes resolved
	HasOperator bool     // true if an unquoted shell operator is present
}

Command is a parsed command line.

func Parse

func Parse(raw string) (Command, error)

Parse tokenizes raw into a Command. It returns ErrUnterminatedQuote for a command line with an unclosed quote; otherwise the error is nil.

Jump to

Keyboard shortcuts

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