app

package
v0.0.0-...-161b4be Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InitUsage = `` /* 242-byte string literal not displayed */

	VersionUsage = `Display the current build version of autobot.`
	ServeUsage   = `` /* 676-byte string literal not displayed */

	SyncUsage = `` /* 448-byte string literal not displayed */

	LookupUsage = `Perform a vehicle lookup based on registration or VIN.

  Formatting is currently limited to a human readable format.`
	ClearUsage = `Clear the vehicle store of all data.

  You need to run the sync command again before any vehicle data will be available.`
	StatusUsage = `Show status of the vehicle store.

  Shows some useful stats such as number of vehicles, time of last synchronisation etc.`
	DisableUsage = `` /* 162-byte string literal not displayed */

	EnableUsage = `` /* 141-byte string literal not displayed */

	QueryUsage = `` /* 292-byte string literal not displayed */

)

These are usage (help) texts shown when the app is started without the required arguments. Note: Using an indentation of two spaces as it provides a nice "look" in the console.

Functions

func Start

func Start() error

Start runs a command.

Types

type ClearCommand

type ClearCommand struct {
	Clear bool `short:"l" long:"clear" description:"Clears the entire vehicle store"`
}

ClearCommand contains options for clearing the vehicle store.

func (*ClearCommand) Execute

func (cmd *ClearCommand) Execute(opts []string) error

Execute runs the command.

func (*ClearCommand) IsConnected

func (cmd *ClearCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*ClearCommand) Usage

func (cmd *ClearCommand) Usage() string

Usage prints help text to the user.

type DisableCommand

type DisableCommand struct {
	Hash string `short:"h" long:"hash" description:"Hash of vehicle to disable"`
}

DisableCommand disables a vehicle so it won't appear in lookups.

func (*DisableCommand) Execute

func (cmd *DisableCommand) Execute(opts []string) error

Execute runs the disable command.

func (*DisableCommand) IsConnected

func (cmd *DisableCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*DisableCommand) Usage

func (cmd *DisableCommand) Usage() string

Usage prints help text to the user.

type EnableCommand

type EnableCommand struct {
	Hash string `short:"h" long:"hash" description:"Hash of vehicle to enable"`
}

EnableCommand enables a previously disabled vehicle so it will reappear in lookups.

func (*EnableCommand) Execute

func (cmd *EnableCommand) Execute(opts []string) error

Execute runs the enable command.

func (*EnableCommand) IsConnected

func (cmd *EnableCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*EnableCommand) Usage

func (cmd *EnableCommand) Usage() string

Usage prints help text to the user.

type InitCommand

type InitCommand struct{}

InitCommand writes an empty configuration file to cwd, to help the user getting started with autobot.

func (*InitCommand) Execute

func (cmd *InitCommand) Execute(opts []string) error

Execute writes the empty configuration file to the current working directory.

func (*InitCommand) IsConnected

func (cmd *InitCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*InitCommand) Usage

func (cmd *InitCommand) Usage() string

Usage prints help text to the user.

type LookupCommand

type LookupCommand struct {
	Country  string `short:"c" long:"country" description:"Country where vehicle is registered" required:"yes" choice:"DK" choice:"NO"`
	VIN      string `short:"v" long:"vin" description:"VIN number to lookup, if any (will not synchronize data)"`
	RegNr    string `short:"r" long:"regnr" description:"Registration number to lookup, if any (will not synchronize data)"`
	Disabled bool   `short:"d" long:"disabled" description:"Include vehicle in result even if disabled"`
}

LookupCommand contains options for vehicle lookups using reg.nr. or VIN.

func (*LookupCommand) Execute

func (cmd *LookupCommand) Execute(opts []string) error

Execute is called by go-flags and thus bootstraps the LookupCommand.

func (*LookupCommand) IsConnected

func (cmd *LookupCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*LookupCommand) Usage

func (cmd *LookupCommand) Usage() string

Usage prints help text to the user.

type Options

type Options struct {
	ConfigFile string `short:"c" long:"config-file" required:"no" default:"config.toml" description:"Application configuration file in TOML format"`
}

Options contains command-line arguments parsed upon application initialisation.

type QueryCommand

type QueryCommand struct {
	Limit    uint   `short:"l" long:"limit" description:"Limit on number of vehicles to return" default:"0"`
	Type     string `short:"t" long:"type" description:"Type of vehicle to filter by: Car|Bus|Van|Truck|Trailer|Unknown"`
	Brand    string `short:"b" long:"brand" description:"Brand name to filter by, case insensitive"`
	Model    string `short:"m" long:"model" description:"Model name to filter by, case insensitive"`
	FuelType string `short:"f" long:"fuel-type" description:"Fuel-type to filter by, case insensitive"`
}

QueryCommand represents a query/search against the vehicle store.

func (*QueryCommand) Execute

func (cmd *QueryCommand) Execute(opts []string) error

Execute performs a query against the vehicle store.

func (*QueryCommand) IsConnected

func (cmd *QueryCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*QueryCommand) Usage

func (cmd *QueryCommand) Usage() string

Usage prints help text to the user.

type ServeCommand

type ServeCommand struct {
	Port   uint `short:"p" long:"port" default:"1826" description:"Port number to listen on"`
	NoSync bool `short:"s" long:"no-sync" description:"Runs the web server without background synchronisation"`
}

ServeCommand is responsible for initialising and booting up a web server that supports much of the same functionality that is also provided via the CLI.

func (*ServeCommand) Execute

func (cmd *ServeCommand) Execute(opts []string) error

Execute runs the web server. It does not return unless the web server stops functioning.

func (*ServeCommand) IsConnected

func (cmd *ServeCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*ServeCommand) Usage

func (cmd *ServeCommand) Usage() string

Usage prints help text to the user.

type StatusCommand

type StatusCommand struct {
	Status bool `short:"s" long:"status" description:"Displays the last synchronisation log"`
}

StatusCommand contains options for displaying the status of the vehicle store.

func (*StatusCommand) Execute

func (cmd *StatusCommand) Execute(opts []string) error

Execute runs the command.

func (*StatusCommand) IsConnected

func (cmd *StatusCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*StatusCommand) Usage

func (cmd *StatusCommand) Usage() string

Usage prints help text to the user.

type SyncCommand

type SyncCommand struct {
	Provider   string `short:"p" long:"provider" required:"yes" description:"Name of provider to sync with"`
	SourceFile string `short:"f" long:"source-file" description:"DMR XML file in UTF-8 format"`
	Debug      bool   `short:"d" long:"debug" description:"Debug: print CPU count, goroutine count and memory usage every 10 seconds"`
}

SyncCommand contains options for synchronising the vehicle store with an external source.

func (*SyncCommand) Execute

func (cmd *SyncCommand) Execute(opts []string) error

Execute runs the command.

func (*SyncCommand) IsConnected

func (cmd *SyncCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*SyncCommand) Usage

func (cmd *SyncCommand) Usage() string

Usage prints help text to the user.

type VersionCommand

type VersionCommand struct{}

VersionCommand displays the current build version of autobot.

func (*VersionCommand) Execute

func (cmd *VersionCommand) Execute(opts []string) error

Execute displays the current build version of autobot.

func (*VersionCommand) IsConnected

func (cmd *VersionCommand) IsConnected() bool

IsConnected reports whether or not this command needs to connect to the VehicleStore.

func (*VersionCommand) Usage

func (cmd *VersionCommand) Usage() string

Usage prints help text to the user.

Jump to

Keyboard shortcuts

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