Documentation
¶
Index ¶
- Constants
- Variables
- func Execute(args []string) (err error)
- func ExitCode(err error) int
- func ResolveStation(ctx context.Context, client *api.Client, name string, jsonMode bool) (*api.Station, error)
- func VersionString() string
- type BashCompletionCmd
- type CLI
- type CompletionCmd
- type CompositionCmd
- type ConnectionsCmd
- type DisturbancesCmd
- type ExitError
- type FishCompletionCmd
- type LiveboardCmd
- type RootFlags
- type StationsCmd
- type VehicleCmd
- type VersionCmd
- type ZshCompletionCmd
Constants ¶
View Source
const ( ExitSuccess = 0 ExitGeneralError = 1 ExitInvalidArgs = 2 ExitAPIError = 3 ExitNotFound = 4 ExitRateLimited = 5 )
Exit codes
Variables ¶
View Source
var ErrStationCanceled = errors.New("station selection canceled")
ErrStationCanceled is returned when station selection is canceled.
Functions ¶
func ResolveStation ¶
func ResolveStation(ctx context.Context, client *api.Client, name string, jsonMode bool) (*api.Station, error)
ResolveStation resolves a station name to a Station object. If the name is ambiguous, it shows a picker. If JSON mode is enabled, it returns an error instead of showing picker.
func VersionString ¶
func VersionString() string
Types ¶
type BashCompletionCmd ¶
type BashCompletionCmd struct{}
func (*BashCompletionCmd) Run ¶
func (c *BashCompletionCmd) 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 information"`
Stations StationsCmd `cmd:"" help:"List or search stations"`
Liveboard LiveboardCmd `cmd:"" help:"Show departures or arrivals for a station"`
Connections ConnectionsCmd `cmd:"" help:"Find connections between stations"`
Vehicle VehicleCmd `cmd:"" help:"Show vehicle/train information"`
Composition CompositionCmd `cmd:"" help:"Show train composition"`
Disturbances DisturbancesCmd `cmd:"" help:"Show service disturbances"`
Completion CompletionCmd `cmd:"" help:"Generate shell completions"`
}
type CompletionCmd ¶
type CompletionCmd struct {
Bash BashCompletionCmd `cmd:"" help:"Generate bash completion script"`
Zsh ZshCompletionCmd `cmd:"" help:"Generate zsh completion script"`
Fish FishCompletionCmd `cmd:"" help:"Generate fish completion script"`
}
type CompositionCmd ¶
type CompositionCmd struct {
ID string `arg:"" help:"Vehicle/train ID (e.g., S51507)"`
}
func (*CompositionCmd) Run ¶
func (c *CompositionCmd) Run(root *RootFlags) error
type ConnectionsCmd ¶
type ConnectionsCmd struct {
From string `arg:"" help:"Departure station"`
To string `arg:"" help:"Arrival station"`
Time string `help:"Departure time (HH:MM)" short:"t"`
Date string `help:"Date (YYYY-MM-DD)" short:"d"`
ArriveBy bool `help:"Time is arrival time" short:"a"`
Results int `help:"Number of results" default:"6" short:"n"`
}
func (*ConnectionsCmd) Run ¶
func (c *ConnectionsCmd) Run(root *RootFlags) error
type DisturbancesCmd ¶
type DisturbancesCmd struct {
Type string `help:"Filter by type: planned, disturbance" short:"t"`
}
func (*DisturbancesCmd) Run ¶
func (c *DisturbancesCmd) Run(root *RootFlags) error
type FishCompletionCmd ¶
type FishCompletionCmd struct{}
func (*FishCompletionCmd) Run ¶
func (c *FishCompletionCmd) Run() error
type LiveboardCmd ¶
type LiveboardCmd struct {
Station string `arg:"" help:"Station name or ID"`
Arrivals bool `help:"Show arrivals instead of departures" short:"a"`
Time string `help:"Time (HH:MM)" short:"t"`
Date string `help:"Date (YYYY-MM-DD)" short:"d"`
Alerts bool `help:"Show alerts" default:"true"`
}
func (*LiveboardCmd) Run ¶
func (c *LiveboardCmd) Run(root *RootFlags) error
type RootFlags ¶
type RootFlags struct {
JSON bool `help:"Output JSON to stdout"`
Lang string `help:"Language (nl, fr, en, de)" default:"" env:"IRAIL_LANG"`
NoColor bool `help:"Disable colors" env:"NO_COLOR"`
}
func (*RootFlags) DetectLang ¶
DetectLang returns the language from IRAIL_LANG, LANG, or LC_ALL env vars.
type StationsCmd ¶
type StationsCmd struct {
Search string `help:"Filter stations by name" short:"s"`
}
func (*StationsCmd) Run ¶
func (c *StationsCmd) Run(root *RootFlags) error
type VehicleCmd ¶
type VehicleCmd struct {
ID string `arg:"" help:"Vehicle/train ID (e.g., IC1832)"`
Date string `help:"Date (YYYY-MM-DD)" short:"d"`
Stops bool `help:"Show all stops" short:"s"`
Alerts bool `help:"Show alerts" default:"true"`
}
func (*VehicleCmd) Run ¶
func (c *VehicleCmd) Run(root *RootFlags) error
type VersionCmd ¶
type VersionCmd struct{}
func (*VersionCmd) Run ¶
func (c *VersionCmd) Run() error
type ZshCompletionCmd ¶
type ZshCompletionCmd struct{}
func (*ZshCompletionCmd) Run ¶
func (c *ZshCompletionCmd) Run() error
Click to show internal directories.
Click to hide internal directories.