cli

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cli performs mode-defining argument parsing before expensive runtime construction, ensuring diagnostics and stdout obey the selected surface.

Index

Constants

View Source
const (
	OutputText       OutputFormat = "text"
	OutputJSON       OutputFormat = "json"
	OutputStreamJSON OutputFormat = "stream-json"
	InputText        InputFormat  = "text"
	InputStreamJSON  InputFormat  = "stream-json"
)

Variables

This section is empty.

Functions

func HeadlessRequested

func HeadlessRequested(args []string, stdoutTerminal bool) bool

HeadlessRequested performs the same option/value/-- parsing and presentation inference as the application before root assigns SIGINT ownership. Invalid, informational, and standalone-MCP invocations deliberately return false because no headless model turn can start from them.

func IsUsageError

func IsUsageError(err error) bool

func RawPrintRequested

func RawPrintRequested(args []string) bool

RawPrintRequested is retained for callers that specifically need to know whether -p/--print was present, rather than whether the eventual surface is headless.

func Usage

func Usage() string

Types

type InputFormat

type InputFormat string

type Options

type Options struct {
	Print                  bool
	Version                bool
	Help                   bool
	Debug                  bool
	Verbose                bool
	Bare                   bool
	TrustWorkspace         bool
	OutputStyle            string
	MCPConfig              string
	MCPServer              bool
	OutputFormat           OutputFormat
	InputFormat            InputFormat
	IncludePartial         bool
	ReplayUserMessages     bool
	JSONSchema             string
	SDKURL                 string
	CWD                    string
	Provider               string
	Model                  string
	Effort                 string
	PermissionMode         string
	DangerouslyBypass      bool
	AllowedTools           []string
	DisallowedTools        []string
	Attachments            []string
	MaxTurns               int
	MaxBudgetUSD           float64
	SessionID              string
	Resume                 string
	Continue               bool
	ForkSession            bool
	ListProviders          bool
	ListSessions           bool
	DeleteSession          string
	SessionRevision        string
	SessionPageSize        int
	SessionPageToken       string
	NoSessionPersistence   bool
	OwnedProcessTree       bool
	SystemPrompt           string
	SystemPromptFile       string
	AppendSystemPrompt     string
	AppendSystemPromptFile string
	Prompt                 string
	// contains filtered or unexported fields
}

func InferPrint

func InferPrint(options Options, stdoutTerminal bool) Options

InferPrint applies the presentation inference that happens after argument parsing. A structured format is always headless, and redirected text output uses the one-shot adapter unless the standalone MCP host was selected.

func Parse

func Parse(args []string) (Options, error)

func (Options) ProviderDiscoveryRequested added in v1.0.8

func (o Options) ProviderDiscoveryRequested() bool

ProviderDiscoveryRequested reports whether the command line selected the provider-neutral registry discovery operation.

func (Options) SessionManagementRequested added in v1.0.7

func (o Options) SessionManagementRequested() bool

SessionManagementRequested reports whether the command line selected a provider-free native session-management operation.

func (Options) Validate

func (o Options) Validate() error

type OutputFormat

type OutputFormat string

type UsageError

type UsageError struct{ Message string }

func (*UsageError) Error

func (e *UsageError) Error() string

func (*UsageError) Is

func (e *UsageError) Is(target error) bool

Jump to

Keyboard shortcuts

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