cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(args []string) error

func ExitCode

func ExitCode(err error) int

func VersionString

func VersionString() string

Types

type CLI

type CLI struct {
	RootFlags `embed:""`

	Version kong.VersionFlag `help:"Print version and exit"`

	Profile    ProfileCmd  `cmd:"" help:"Inspect configured profiles"`
	Doctor     DoctorCmd   `cmd:"" help:"Validate config, auth, connectivity, and engine detection"`
	Search     SearchCmd   `cmd:"" help:"Search logs/documents using query_string or raw body"`
	Sample     SampleCmd   `cmd:"" help:"Fetch one or a few sample documents"`
	Count      CountCmd    `cmd:"" help:"Count matching documents"`
	Raw        RawCmd      `cmd:"" help:"Run an arbitrary HTTP request against the cluster"`
	Indices    IndicesCmd  `cmd:"" aliases:"index" help:"Index discovery helpers"`
	Fields     FieldsCmd   `cmd:"" aliases:"field" help:"Field discovery helpers"`
	Mappings   MappingsCmd `cmd:"" aliases:"mapping" help:"Mapping inspection helpers"`
	Target     TargetCmd   `cmd:"" help:"Inspect configured targets in the selected profile"`
	Schema     SchemaCmd   `cmd:"" help:"Machine-readable command schema"`
	VersionCmd VersionCmd  `cmd:"" name:"version" help:"Print version/build info"`
}

type CountCmd

type CountCmd struct {
	Query     string   `arg:"" optional:"" name:"query" help:"query_string query"`
	QueryFlag string   `name:"query" short:"q" help:"query_string query (alternative to positional arg)"`
	Index     []string `name:"index" short:"i" help:"Index pattern to count (repeatable)"`
	Target    string   `help:"Target name from selected profile"`
	From      string   `help:"Start timestamp (RFC3339)"`
	To        string   `help:"End timestamp (RFC3339)"`
	Last      string   `help:"Relative lookback duration like 30m, 4h, 24h" default:"1h"`
	TimeField string   `name:"time-field" help:"Override time field"`
	Body      string   `help:"Inline JSON body or @path/to/file.json"`
}

func (*CountCmd) Run

func (c *CountCmd) Run(ctx context.Context, flags *RootFlags) error

type DoctorCmd

type DoctorCmd struct{}

func (*DoctorCmd) Run

func (c *DoctorCmd) Run(ctx context.Context, flags *RootFlags) error

type ExitError

type ExitError struct {
	Code int
	Err  error
}

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

type FieldsCmd

type FieldsCmd struct {
	List FieldsListCmd `cmd:"" help:"List fields using _field_caps"`
}

type FieldsListCmd

type FieldsListCmd struct {
	Index  []string `name:"index" short:"i" help:"Index pattern (repeatable)"`
	Target string   `help:"Target name from selected profile"`
}

func (*FieldsListCmd) Run

func (c *FieldsListCmd) Run(ctx context.Context, flags *RootFlags) error

type IndicesCmd

type IndicesCmd struct {
	List IndicesListCmd `cmd:"" help:"List indices"`
}

type IndicesListCmd

type IndicesListCmd struct {
	Index []string `name:"index" short:"i" help:"Optional index pattern filter (repeatable)"`
}

func (*IndicesListCmd) Run

func (c *IndicesListCmd) Run(ctx context.Context, flags *RootFlags) error

type MappingsCmd

type MappingsCmd struct {
	Get MappingsGetCmd `cmd:"" help:"Get mappings for indices"`
}

type MappingsGetCmd

type MappingsGetCmd struct {
	Index  []string `name:"index" short:"i" help:"Index pattern (repeatable)"`
	Target string   `help:"Target name from selected profile"`
}

func (*MappingsGetCmd) Run

func (c *MappingsGetCmd) Run(ctx context.Context, flags *RootFlags) error

type ProfileCmd

type ProfileCmd struct {
	List ProfileListCmd `cmd:"" help:"List configured profiles"`
	Show ProfileShowCmd `cmd:"" help:"Show one configured profile"`
	Path ProfilePathCmd `cmd:"" help:"Print config file path"`
	Test ProfileTestCmd `cmd:"" help:"Test connectivity using a configured profile"`
}

type ProfileListCmd

type ProfileListCmd struct{}

func (*ProfileListCmd) Run

func (c *ProfileListCmd) Run(ctx context.Context, flags *RootFlags) error

type ProfilePathCmd

type ProfilePathCmd struct{}

func (*ProfilePathCmd) Run

func (c *ProfilePathCmd) Run(ctx context.Context, flags *RootFlags) error

type ProfileShowCmd

type ProfileShowCmd struct {
	Name string `arg:"" help:"Profile name"`
}

func (*ProfileShowCmd) Run

func (c *ProfileShowCmd) Run(ctx context.Context, flags *RootFlags) error

type ProfileTestCmd

type ProfileTestCmd struct {
	Name string `arg:"" optional:"" help:"Profile name (defaults to selected/default profile)"`
}

func (*ProfileTestCmd) Run

func (c *ProfileTestCmd) Run(ctx context.Context, flags *RootFlags) error

type RawCmd

type RawCmd struct {
	Method string `arg:"" help:"HTTP method" enum:"GET,POST,PUT,PATCH,DELETE,HEAD"`
	Path   string `arg:"" help:"Request path, e.g. /_cluster/health or /logs-*/_search"`
	Body   string `help:"Inline JSON body or @path/to/file.json"`
}

func (*RawCmd) Run

func (c *RawCmd) Run(ctx context.Context, flags *RootFlags) error

type RootFlags

type RootFlags struct {
	Profile     string `help:"Profile name from config" short:"p"`
	Endpoint    string `help:"Override cluster endpoint URL" env:"ESQ_ENDPOINT"`
	Color       string `help:"Color output: auto|always|never" default:"auto" enum:"auto,always,never"`
	JSON        bool   `help:"Output JSON to stdout" short:"j" aliases:"machine"`
	Plain       bool   `help:"Output stable parseable text to stdout" aliases:"tsv"`
	ResultsOnly bool   `name:"results-only" help:"In JSON mode, emit only primary result data where possible"`
	Select      string `help:"In JSON mode, select comma-separated fields" aliases:"pick,project"`
	NoInput     bool   `help:"Never prompt; fail instead"`
	Verbose     bool   `help:"Enable verbose logging" short:"v"`
}

type SampleCmd

type SampleCmd struct {
	Query     string   `arg:"" optional:"" name:"query" help:"query_string query"`
	QueryFlag string   `name:"query" short:"q" help:"query_string query (alternative to positional arg)"`
	Index     []string `name:"index" short:"i" help:"Index pattern to sample (repeatable)"`
	Target    string   `help:"Target name from selected profile"`
	From      string   `help:"Start timestamp (RFC3339)"`
	To        string   `help:"End timestamp (RFC3339)"`
	Last      string   `help:"Relative lookback duration like 30m, 4h, 24h" default:"1h"`
	Size      int      `help:"Number of sample hits to return" default:"3"`
	Sort      string   `help:"Sort order for time field" enum:"asc,desc" default:"desc"`
	TimeField string   `name:"time-field" help:"Override time field"`
	Columns   string   `help:"Comma-separated fields to render in human output"`
	Source    string   `help:"Comma-separated _source fields to request"`
	Body      string   `help:"Inline JSON body or @path/to/file.json"`
}

func (*SampleCmd) Run

func (c *SampleCmd) Run(ctx context.Context, flags *RootFlags) error

type SchemaCmd

type SchemaCmd struct {
	Command       []string `arg:"" optional:"" name:"command" help:"Optional command path to describe, e.g. search or profile test"`
	IncludeHidden bool     `name:"include-hidden" help:"Include hidden commands and flags"`
}

func (*SchemaCmd) Run

func (c *SchemaCmd) Run(ctx context.Context, kctx *kong.Context) error

type SearchCmd

type SearchCmd struct {
	Query     string   `arg:"" optional:"" name:"query" help:"query_string query"`
	QueryFlag string   `name:"query" short:"q" help:"query_string query (alternative to positional arg)"`
	Index     []string `name:"index" short:"i" help:"Index pattern to search (repeatable)"`
	Target    string   `help:"Target name from selected profile"`
	From      string   `help:"Start timestamp (RFC3339)"`
	To        string   `help:"End timestamp (RFC3339)"`
	Last      string   `help:"Relative lookback duration like 30m, 4h, 24h" default:"1h"`
	Size      int      `help:"Number of hits to return" default:"50"`
	Sort      string   `help:"Sort order for time field" enum:"asc,desc" default:"desc"`
	TimeField string   `name:"time-field" help:"Override time field"`
	Columns   string   `help:"Comma-separated fields to render in human output"`
	Source    string   `help:"Comma-separated _source fields to request"`
	Body      string   `help:"Inline JSON body or @path/to/file.json"`
}

func (*SearchCmd) Run

func (c *SearchCmd) Run(ctx context.Context, flags *RootFlags) error

type TargetCmd

type TargetCmd struct {
	List TargetListCmd `cmd:"" help:"List targets in the selected profile"`
	Show TargetShowCmd `cmd:"" help:"Show one target from the selected profile"`
}

type TargetListCmd

type TargetListCmd struct{}

func (*TargetListCmd) Run

func (c *TargetListCmd) Run(ctx context.Context, flags *RootFlags) error

type TargetShowCmd

type TargetShowCmd struct {
	Name string `arg:"" help:"Target name"`
}

func (*TargetShowCmd) Run

func (c *TargetShowCmd) Run(ctx context.Context, flags *RootFlags) error

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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