cmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

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

func ExitCode

func ExitCode(err error) int

func ResolveStop

func ResolveStop(ctx context.Context, client *api.Client, ref string) (int, error)

ResolveStop resolves a stop reference to a stop number. Supports:

  • @alias - lookup from favorites
  • numeric - use directly
  • string - search and pick (single result) or error (multiple results)

func VersionString

func VersionString() string

Types

type AmbiguousStopError

type AmbiguousStopError struct {
	Query string
	Stops []api.Stop
}

AmbiguousStopError is returned when multiple stops match a query.

func (*AmbiguousStopError) Error

func (e *AmbiguousStopError) Error() string

type AuthCmd

type AuthCmd struct {
	SetKey AuthSetKeyCmd `cmd:"" name:"set-key" help:"Store API key in keyring"`
	Status AuthStatusCmd `cmd:"" help:"Show authentication status"`
	Remove AuthRemoveCmd `cmd:"" help:"Remove stored API key"`
}

type AuthRemoveCmd

type AuthRemoveCmd struct{}

func (*AuthRemoveCmd) Run

func (c *AuthRemoveCmd) Run() error

type AuthSetKeyCmd

type AuthSetKeyCmd struct {
	Stdin bool `help:"Read API key from stdin (for scripts)"`
}

func (*AuthSetKeyCmd) Run

func (c *AuthSetKeyCmd) Run() error

type AuthStatusCmd

type AuthStatusCmd struct{}

func (*AuthStatusCmd) Run

func (c *AuthStatusCmd) Run() error

type CLI

type CLI struct {
	RootFlags `embed:""`

	Version    kong.VersionFlag `help:"Print version and exit"`
	VersionCmd VersionCmd       `cmd:"" name:"version" help:"Print version"`
	Auth       AuthCmd          `cmd:"" help:"Manage API key"`
	Config     ConfigCmd        `cmd:"" help:"Manage configuration"`
	Stops      StopsCmd         `cmd:"" help:"Search and view stops"`
	Lines      LinesCmd         `cmd:"" help:"Search and view lines"`
	Departures DeparturesCmd    `cmd:"" help:"Show realtime departures"`
	Info       InfoCmd          `cmd:"" help:"Show CLI and API info"`
	Completion CompletionCmd    `cmd:"" help:"Generate shell completions"`
}

type CompletionBashCmd

type CompletionBashCmd struct{}

func (*CompletionBashCmd) Run

func (c *CompletionBashCmd) Run() error

type CompletionCmd

type CompletionCmd struct {
	Bash CompletionBashCmd `cmd:"" help:"Generate bash completions"`
	Zsh  CompletionZshCmd  `cmd:"" help:"Generate zsh completions"`
	Fish CompletionFishCmd `cmd:"" help:"Generate fish completions"`
}

type CompletionFishCmd

type CompletionFishCmd struct{}

func (*CompletionFishCmd) Run

func (c *CompletionFishCmd) Run() error

type CompletionZshCmd

type CompletionZshCmd struct{}

func (*CompletionZshCmd) Run

func (c *CompletionZshCmd) Run() error

type ConfigCmd

type ConfigCmd struct {
	SetFavorite    ConfigSetFavoriteCmd    `cmd:"" name:"set-favorite" help:"Set a favorite stop alias"`
	RemoveFavorite ConfigRemoveFavoriteCmd `cmd:"" name:"remove-favorite" help:"Remove a favorite stop alias"`
	ListFavorites  ConfigListFavoritesCmd  `cmd:"" name:"list-favorites" help:"List all favorite stops"`
}

type ConfigListFavoritesCmd

type ConfigListFavoritesCmd struct{}

func (*ConfigListFavoritesCmd) Run

func (c *ConfigListFavoritesCmd) Run(root *RootFlags) error

type ConfigRemoveFavoriteCmd

type ConfigRemoveFavoriteCmd struct {
	Name string `arg:"" required:"" help:"Alias name to remove"`
}

func (*ConfigRemoveFavoriteCmd) Run

func (c *ConfigRemoveFavoriteCmd) Run() error

type ConfigSetFavoriteCmd

type ConfigSetFavoriteCmd struct {
	Name string `arg:"" required:"" help:"Alias name (e.g., home, work)"`
	Stop string `arg:"" required:"" help:"Stop number (6-digit)"`
}

func (*ConfigSetFavoriteCmd) Run

func (c *ConfigSetFavoriteCmd) Run() error

type DeparturesCmd

type DeparturesCmd struct {
	Stop  string `arg:"" required:"" help:"Stop (number, name, or @favorite)"`
	Watch bool   `help:"Auto-refresh every 30 seconds" short:"w"`
	Count int    `help:"Maximum number of departures" default:"10" short:"n"`
	Line  string `help:"Filter by line number" short:"l"`
}

func (*DeparturesCmd) Run

func (c *DeparturesCmd) Run(root *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 InfoCmd

type InfoCmd struct{}

func (*InfoCmd) Run

func (c *InfoCmd) Run() error

type LinesCmd

type LinesCmd struct {
	Search LinesSearchCmd `cmd:"" help:"Search lines by number or name"`
	Get    LinesGetCmd    `cmd:"" help:"Get line details"`
}

type LinesGetCmd

type LinesGetCmd struct {
	Entity int `arg:"" required:"" help:"Entity number (1-5)"`
	Line   int `arg:"" required:"" help:"Line number"`
}

func (*LinesGetCmd) Run

func (c *LinesGetCmd) Run(root *RootFlags) error

type LinesSearchCmd

type LinesSearchCmd struct {
	Query string `arg:"" required:"" help:"Line number or name"`
}

func (*LinesSearchCmd) Run

func (c *LinesSearchCmd) Run(root *RootFlags) error

type RootFlags

type RootFlags struct {
	JSON    bool `help:"Output JSON to stdout"`
	Plain   bool `help:"Output plain TSV (for scripting)"`
	NoColor bool `help:"Disable colors" env:"NO_COLOR"`
}

type StopsCmd

type StopsCmd struct {
	Search StopsSearchCmd `cmd:"" help:"Search stops by name"`
	Get    StopsGetCmd    `cmd:"" help:"Get stop details by number"`
}

type StopsGetCmd

type StopsGetCmd struct {
	Number string `arg:"" required:"" help:"6-digit stop number (e.g., 200552)"`
}

func (*StopsGetCmd) Run

func (c *StopsGetCmd) Run(root *RootFlags) error

type StopsSearchCmd

type StopsSearchCmd struct {
	Query string `arg:"" required:"" help:"Search query (stop name)"`
}

func (*StopsSearchCmd) Run

func (c *StopsSearchCmd) Run(root *RootFlags) error

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run() error

Jump to

Keyboard shortcuts

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