Documentation
¶
Overview ¶
Package cliinput preserves literal commas across tcli's CSV list binding. It does not parse flags: tcli remains the sole CLI parser and validator.
Index ¶
- Constants
- func Bundle(_ map[string]string) compiler.Bundle
- func CommandLine(ctx context.Context) string
- func Finish(_ context.Context, _ any) (any, error)
- func HasFlag(ctx context.Context, aliases ...string) bool
- func NormalizeFlagNames(args []string) []string
- func Print(_ context.Context, in map[string]any) (map[string]any, error)
- func ProtectCommas(args []string) ([]string, string)
- func ResolveBoolAliases(ctx context.Context, in map[string]any, pairs ...BoolAliases) map[string]any
- func Restore(ctx context.Context, in map[string]any) (map[string]any, error)
- func WithArguments(ctx context.Context, args []string) context.Context
- func WithCommandLine(ctx context.Context, executable string, args []string) context.Context
- func WithInputSchemas(ctx context.Context, schemas map[string]tcli.CLIRequestSchema) context.Context
- func WithInvocation(ctx context.Context, command string, explicitPack bool, marker string) context.Context
- func WithRawArguments(ctx context.Context, args []string) context.Context
- func WrapInputSchemas(meta map[string]any, inner action.AnyAction) (action.AnyAction, error)
- func YAML(_ context.Context, in map[string]any) (map[string]any, error)
- type BoolAliases
- type FieldValue
Constants ¶
const ID = "srcpack_cli"
Variables ¶
This section is empty.
Functions ¶
func CommandLine ¶
CommandLine returns the invocation attached to ctx, or an empty string when the caller did not provide one.
func NormalizeFlagNames ¶
NormalizeFlagNames preserves the old CLI spelling convention without interpreting flags or values. Single-letter short flags remain case-sensitive.
func Print ¶
Print is an exact text-output tap, not a formatter or command dispatcher. Flow decides what to print, where, and whether to continue or fail afterward.
func ProtectCommas ¶
ProtectCommas encodes literal commas before tcli binds list fields. A marker absent from every argument makes the transformation lossless, even when an argument itself contains the marker normally used by this adapter.
func ResolveBoolAliases ¶
func ResolveBoolAliases(ctx context.Context, in map[string]any, pairs ...BoolAliases) map[string]any
ResolveBoolAliases returns a copy containing one positive field per pair. It interprets only typed bool values supplied by tcli, never raw flag values.
func Restore ¶
Restore copies a parsed request, restoring original scalar/list strings. Only the host's syntax facts are added; domain and output decisions belong to the command pipelines.
func WithArguments ¶
WithArguments preserves only lexical flag occurrence order. tcli still does all binding, type conversion and validation. This compatibility shim can be removed when tcli exposes occurrence provenance in its parse result. A flag-looking string cannot be a separate string flag value in tcli; such literal values use --flag=value. Positionals after -- are never inspected.
func WithCommandLine ¶
WithCommandLine stores the canonical executable name and original argv for a single run so reports can show how the command was invoked.
func WithInputSchemas ¶
func WithInputSchemas(ctx context.Context, schemas map[string]tcli.CLIRequestSchema) context.Context
WithInputSchemas attaches the CLI request schemas applicable to an invocation. It is deliberately independent of tcli's parsing/binding path.
func WithInvocation ¶
func WithInvocation(ctx context.Context, command string, explicitPack bool, marker string) context.Context
WithInvocation carries syntax facts for one execution, never global state.
func WithRawArguments ¶
WithRawArguments attaches the command's original argv (without its command name) to a single invocation. The slice is copied so later caller mutation cannot affect observation.
func WrapInputSchemas ¶
WrapInputSchemas adapts Flow @schema metadata into tcli request schemas and makes those schemas available to downstream actions without hard-coding an input schema or changing the request passed through the action.
Types ¶
type BoolAliases ¶
BoolAliases declares inverse spellings for one already-bound boolean value. These are application metadata, not built-in meanings of a `no-` prefix.
type FieldValue ¶
FieldValue is one raw CLI value attributed to a request field. Index is the argv index of the value token (or the flag token for an inline/implicit bool).
func OrderedFieldValues ¶
func OrderedFieldValues(ctx context.Context, schemaName string, fields ...string) []FieldValue
OrderedFieldValues reports selected fields in their original argv order. It observes lexical boundaries only; tcli remains responsible for parsing, conversion and validation. Unknown or otherwise invalid arguments are not errors here because tcli will reject them before invoking a domain action.