Help us shape the future of Go! Take the 2026 Go Developer Survey

tcli

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDebugCommands

func AddDebugCommands() []action.AnyAction

AddDebugCommands returns standard operational CLI commands for probes and network tests.

func ParseCLIRequest added in v0.4.0

func ParseCLIRequest(rawArgs []string, schema CLIRequestSchema) (map[string]any, error)

ParseCLIRequest parses raw CLI arguments against a request schema and returns a typed payload map.

func ValidateRequestSchema added in v0.4.0

func ValidateRequestSchema(schema CLIRequestSchema) error

ValidateRequestSchema checks field names and flag aliases for ambiguity.

Types

type CLIBinding

type CLIBinding struct {
	Command     string
	Aliases     []string
	Description string
	Examples    []string
}

CLIBinding maps an action to a command name, documentation, and examples.

func Command

func Command(cmd, desc string) CLIBinding

Command constructs a new CLI route binding.

func (CLIBinding) String

func (b CLIBinding) String() string

func (CLIBinding) WithAliases

func (b CLIBinding) WithAliases(aliases ...string) CLIBinding

WithAliases attaches alternative invocation aliases.

func (CLIBinding) WithExamples added in v0.2.0

func (b CLIBinding) WithExamples(examples ...string) CLIBinding

WithExamples attaches usage examples to the command help output.

type CLIFieldSpec added in v0.4.0

type CLIFieldSpec struct {
	Name       string
	Type       string
	Flags      []string
	Usage      string
	Required   bool
	Positional bool
}

CLIFieldSpec describes one request field exposed as a CLI flag or positional.

type CLIInputBinding added in v0.4.0

type CLIInputBinding struct {
	Schema CLIRequestSchema
}

CLIInputBinding attaches a CLI request schema to an action independently of the command routing binding.

func (CLIInputBinding) String added in v0.4.0

func (b CLIInputBinding) String() string

type CLIRequestSchema added in v0.4.0

type CLIRequestSchema struct {
	Name   string
	Fields []CLIFieldSpec
}

CLIRequestSchema describes the dynamic request shape for a CLI command.

type Option

type Option func(*Transport)

func WithArgs

func WithArgs(args ...string) Option

func WithCodec

func WithCodec(c codec.Codec) Option

func WithExecutable added in v0.2.0

func WithExecutable(name string) Option

WithExecutable overrides the binary name used in CLI help & usage output.

func WithOutput

func WithOutput(stdout, stderr io.Writer) Option

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Transport

func (*Transport) CanHandle

func (t *Transport) CanHandle(b action.Binding) bool

func (*Transport) Do

func (t *Transport) Do(ctx context.Context, _ any) (any, error)

func (*Transport) Mount

func (t *Transport) Mount(actions []action.AnyAction)

func (*Transport) PrintCommandHelp

func (t *Transport) PrintCommandHelp(act action.AnyAction)

func (*Transport) PrintHelp

func (t *Transport) PrintHelp()

func (*Transport) String

func (t *Transport) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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