cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(args []string) (err error)

Execute parses and runs the CLI.

func VersionString

func VersionString() string

VersionString returns the version string.

Types

type AuthCmd

type AuthCmd struct {
	SetKey AuthSetKeyCmd `cmd:"" help:"Set API key (uses --stdin by default)"`
	Status AuthStatusCmd `cmd:"" help:"Show authentication status"`
	Remove AuthRemoveCmd `cmd:"" help:"Remove stored credentials"`
}

type AuthRemoveCmd

type AuthRemoveCmd struct{}

func (*AuthRemoveCmd) Run

func (cmd *AuthRemoveCmd) Run(ctx context.Context) error

type AuthSetKeyCmd

type AuthSetKeyCmd struct {
	Stdin bool   `help:"Read API key from stdin (default: true)" default:"true"`
	Key   string `arg:"" optional:"" help:"API key (discouraged; exposes in shell history)"`
}

func (*AuthSetKeyCmd) Run

func (cmd *AuthSetKeyCmd) Run(ctx context.Context) error

type AuthStatusCmd

type AuthStatusCmd struct{}

func (*AuthStatusCmd) Run

func (cmd *AuthStatusCmd) Run(ctx context.Context) error

type CLI

type CLI struct {
	RootFlags `embed:""`

	Version    kong.VersionFlag `help:"Print version and exit"`
	Auth       AuthCmd          `cmd:"" help:"Auth and credentials"`
	Hosts      HostsCmd         `cmd:"" help:"Host (console) operations"`
	Sites      SitesCmd         `cmd:"" help:"Site operations"`
	Devices    DevicesCmd       `cmd:"" help:"Device operations"`
	ISPMetrics ISPMetricsCmd    `cmd:"" name:"isp-metrics" help:"ISP performance metrics"`
	VersionCmd VersionCmd       `cmd:"" name:"version" help:"Print version"`
}

CLI is the root Kong command structure.

type DevicesCmd

type DevicesCmd struct {
	List DevicesListCmd `cmd:"" help:"List all devices"`
}

type DevicesListCmd

type DevicesListCmd struct {
	Host     string `help:"Filter by host ID" name:"host" default:""`
	PageSize int    `help:"Number of results per page" name:"page-size" default:"0"`
}

func (*DevicesListCmd) Run

func (cmd *DevicesListCmd) Run(ctx context.Context) error

type ExitError

type ExitError struct {
	Code int
	Err  error
}

ExitError wraps an error with an exit code.

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

Unwrap returns the underlying error.

type HostsCmd

type HostsCmd struct {
	List HostsListCmd `cmd:"" help:"List all hosts"`
	Get  HostsGetCmd  `cmd:"" help:"Get host by ID"`
}

type HostsGetCmd

type HostsGetCmd struct {
	ID string `arg:"" required:"" help:"Host ID"`
}

func (*HostsGetCmd) Run

func (cmd *HostsGetCmd) Run(ctx context.Context) error

type HostsListCmd

type HostsListCmd struct {
	PageSize int `help:"Number of results per page" name:"page-size" default:"0"`
}

func (*HostsListCmd) Run

func (cmd *HostsListCmd) Run(ctx context.Context) error

type ISPMetricsCmd

type ISPMetricsCmd struct {
	Get ISPMetricsGetCmd `cmd:"" help:"Get ISP performance metrics"`
}

type ISPMetricsGetCmd

type ISPMetricsGetCmd struct {
	Type     string `arg:"" required:"" help:"Metric type: 5m or 1h"`
	Duration string `help:"Duration: 24h, 7d, or 30d" default:""`
	Begin    string `help:"Begin timestamp (epoch)" default:""`
	End      string `help:"End timestamp (epoch)" default:""`
}

func (*ISPMetricsGetCmd) Run

func (cmd *ISPMetricsGetCmd) Run(ctx context.Context) error

type RootFlags

type RootFlags struct {
	Color   string `help:"Color output: auto|always|never" default:"${color}"`
	JSON    bool   `help:"Output JSON to stdout (best for scripting)" default:"${json}"`
	Plain   bool   `help:"Output stable, parseable text to stdout (TSV; no colors)" default:"${plain}"`
	Force   bool   `help:"Skip confirmations for destructive commands"`
	NoInput bool   `help:"Never prompt; fail instead (useful for CI)"`
	Verbose bool   `help:"Enable verbose logging"`
}

RootFlags holds global CLI flags.

type SitesCmd

type SitesCmd struct {
	List SitesListCmd `cmd:"" help:"List all sites"`
}

type SitesListCmd

type SitesListCmd struct {
	PageSize int `help:"Number of results per page" name:"page-size" default:"0"`
}

func (*SitesListCmd) Run

func (cmd *SitesListCmd) Run(ctx context.Context) error

type VersionCmd

type VersionCmd struct{}

VersionCmd prints version information.

func (*VersionCmd) Run

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

Jump to

Keyboard shortcuts

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