trams

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 8 Imported by: 0

README

trams

A command line application written in Go to display realtime departure information for Metrolink trams in the Transport for Greater Manchester (TfGM) area in the UK. The information displayed is the same as displayed on the physical departure boards at each Metrolink station.

The backend API providing the data is a GCP Cloud Function also written in Go.The repository is here.

Display departure information

To display information for a specific station run the trams display command with a list of all short station codes you want to display e.g. ABM CHO EXS etc. If you do not provide any short station codes then all Metrolink stations will be displayed.

trams display

List station codes and names

To get a list of all the station codes (e.g. ABM, CHO etc) run the trams list command.

trams list

Help and version information

./trams help
./trams version

Installation

As well as building from this source repository, you can download a binary file for Linux, Mac and Windows from the Releases page under the Assets section.

Once downloaded you will probably have to make the binary executable.

For example if you download the Linux binary trams-linux-amd6 you can run the following commands to rename the binary and make it executable assuming it is in your Downloads folder).

mv ~/Downloads/trams-linux-amd64 ~/Downloads/trams
chmod +x ~/Downloads/trams
~/Downloads/trams display

Lipgloss

All the colours and layout were generated using the awesome Lipgloss library!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the main API for communicating with the trams backend cloud function. TODO: use timeout

func NewClient

func NewClient(url string, timeout int) Client

NewClient returns a new trams client where url is the backend cloud function URL and timeout is the timeout in milliseconds for responses.

func (Client) Get added in v0.1.0

func (c Client) Get(ids ...string) ([]Metrolink, error)

Get retrieves information about the specified Metrolink stations. If no station IDs is empty retrives all stations.

func (Client) List

func (c Client) List() ([]StationID, error)

List all available station IDs.

type Metrolink struct {
	Id              int
	Line            string
	TLAREF          string
	PIDREF          string
	StationLocation string
	AtcoCode        string
	Direction       string
	Dest0           string
	Carriages0      string
	Status0         string
	Wait0           string
	Dest1           string
	Carriages1      string
	Status1         string
	Wait1           string
	Dest2           string
	Carriages2      string
	Status2         string
	Wait2           string
	Dest3           string
	Carriages3      string
	Status3         string
	MessageBoard    string
	Wait3           string
	LastUpdated     time.Time
}

Metrolink provides information for a station location.

func (Metrolink) Platform added in v0.1.0

func (m Metrolink) Platform() string

type StationID

type StationID struct {
	Id              int
	TLAREF          string
	StationLocation string
}

StationID identifies a Metrolink station.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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