cmd

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationRequiringCommand

type AuthenticationRequiringCommand struct {
	GenericCommand
	AuthenticatingCommand Command
}

AuthenticationRequiringCommand is a representation of a Hub CLI command that requires authentication before executing

func NewBandwidthMonitorCommand added in v0.4.0

func NewBandwidthMonitorCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewBandwidthMonitorCommand creates a new command to invoke the Hub BandwidthMonitor function

func NewBroadbandProductTypeCommand added in v0.4.0

func NewBroadbandProductTypeCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewBroadbandProductTypeCommand creates a new command to invoke the Hub BroadbandProductType function

func NewConnectedDevicesCommand added in v0.4.0

func NewConnectedDevicesCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewConnectedDevicesCommand creates a new command to invoke the Hub ConnectedDevices function

func NewDataPumpVersionCommand added in v0.4.0

func NewDataPumpVersionCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDataPumpVersionCommand creates a new command to invoke the Hub DataPumpVersion function

func NewDataReceivedCommand added in v0.4.0

func NewDataReceivedCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDataReceivedCommand creates a new command to invoke the Hub DataReceived function

func NewDataSentCommand added in v0.4.0

func NewDataSentCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDataSentCommand creates a new command to invoke the Hub DataSent function

func NewDeviceInfoCommand added in v0.4.0

func NewDeviceInfoCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDeviceInfoCommand creates a new command to invoke the Hub DeviceInfo function

func NewDhcpAuthoritativeCommand added in v0.4.0

func NewDhcpAuthoritativeCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDhcpAuthoritativeCommand creates a new command to invoke the Hub DhcpAuthoritative function

func NewDhcpPoolEndCommand added in v0.4.0

func NewDhcpPoolEndCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDhcpPoolEndCommand creates a new command to invoke the Hub DhcpPoolEnd function

func NewDhcpPoolStartCommand added in v0.4.0

func NewDhcpPoolStartCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDhcpPoolStartCommand creates a new command to invoke the Hub DhcpPoolStart function

func NewDhcpSubnetMaskCommand added in v0.4.0

func NewDhcpSubnetMaskCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDhcpSubnetMaskCommand creates a new command to invoke the Hub DhcpSubnetMask function

func NewDownstreamSyncSpeedCommand added in v0.4.0

func NewDownstreamSyncSpeedCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewDownstreamSyncSpeedCommand creates a new command to invoke the Hub DownstreamSyncSpeed function

func NewEnableDhcpAuthoritativeCommand added in v0.4.0

func NewEnableDhcpAuthoritativeCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewEnableDhcpAuthoritativeCommand creates a new command to invoke the Hub EnableDhcpAuthoritative function

func NewEventLogCommand added in v0.4.0

func NewEventLogCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewEventLogCommand creates a new command to invoke the Hub EventLog function

func NewHardwareVersionCommand added in v0.4.0

func NewHardwareVersionCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewHardwareVersionCommand creates a new command to invoke the Hub HardwareVersion function

func NewInternetConnectionStatusCommand added in v0.4.0

func NewInternetConnectionStatusCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewInternetConnectionStatusCommand creates a new command to invoke the Hub InternetConnectionStatus function

func NewLightBrightnessCommand added in v0.4.0

func NewLightBrightnessCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewLightBrightnessCommand creates a new command to invoke the Hub LightBrightness function

func NewLightBrightnessSetCommand added in v0.4.0

func NewLightBrightnessSetCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewLightBrightnessSetCommand creates a new command to invoke the Hub LightBrightnessSet function

func NewLightEnableCommand added in v0.4.0

func NewLightEnableCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewLightEnableCommand creates a new command to invoke the Hub LightEnable function

func NewLightStatusCommand added in v0.4.0

func NewLightStatusCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewLightStatusCommand creates a new command to invoke the Hub LightStatus function

func NewLocalTimeCommand added in v0.4.0

func NewLocalTimeCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewLocalTimeCommand creates a new command to invoke the Hub LocalTime function

func NewMaintenanceFirmwareVersionCommand added in v0.4.0

func NewMaintenanceFirmwareVersionCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewMaintenanceFirmwareVersionCommand creates a new command to invoke the Hub MaintenanceFirmwareVersion function

func NewNatRuleCommand added in v0.4.0

func NewNatRuleCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewNatRuleCommand creates a new command to invoke the Hub NatRule function

func NewNatRuleCreateCommand added in v0.5.0

func NewNatRuleCreateCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewNatRuleCreateCommand creates a new command to invoke the Hub NatRuleCreate function

func NewNatRuleDeleteCommand added in v0.4.0

func NewNatRuleDeleteCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewNatRuleDeleteCommand creates a new command to invoke the Hub NatRuleDelete function

func NewNatRulesCommand added in v0.4.0

func NewNatRulesCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewNatRulesCommand creates a new command to invoke the Hub NatRules function

func NewPublicIPAddressCommand added in v0.4.0

func NewPublicIPAddressCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewPublicIPAddressCommand creates a new command to invoke the Hub PublicIPAddress function

func NewPublicSubnetMaskCommand added in v0.4.0

func NewPublicSubnetMaskCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewPublicSubnetMaskCommand creates a new command to invoke the Hub PublicSubnetMask function

func NewRebootCommand added in v0.4.0

func NewRebootCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewRebootCommand creates a new command to invoke the Hub Reboot function

func NewSambaHostCommand added in v0.4.0

func NewSambaHostCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewSambaHostCommand creates a new command to invoke the Hub SambaHost function

func NewSambaIPCommand added in v0.4.0

func NewSambaIPCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewSambaIPCommand creates a new command to invoke the Hub SambaIP function

func NewSerialNumberCommand added in v0.4.0

func NewSerialNumberCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewSerialNumberCommand creates a new command to invoke the Hub SerialNumber function

func NewSoftwareVersionCommand added in v0.4.0

func NewSoftwareVersionCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewSoftwareVersionCommand creates a new command to invoke the Hub SoftwareVersion function

func NewUpstreamSyncSpeedCommand added in v0.4.0

func NewUpstreamSyncSpeedCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewUpstreamSyncSpeedCommand creates a new command to invoke the Hub UpstreamSyncSpeed function

func NewVersionCommand added in v0.4.0

func NewVersionCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewVersionCommand creates a new command to invoke the Hub Version function

func NewWiFiFrequency24GhzChannelSetCommand added in v0.5.0

func NewWiFiFrequency24GhzChannelSetCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewWiFiFrequency24GhzChannelSetCommand creates a new command to invoke the Hub WiFiFrequency24GhzChannelSet function

func NewWiFiFrequency5GhzChannelSetCommand added in v0.5.0

func NewWiFiFrequency5GhzChannelSetCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewWiFiFrequency5GhzChannelSetCommand creates a new command to invoke the Hub WiFiFrequency5GhzChannelSet function

func NewWiFiFrquency24GhzCommand added in v0.5.0

func NewWiFiFrquency24GhzCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewWiFiFrquency24GhzCommand creates a new command to invoke the Hub WiFiFrquency24GhzCommand function

func NewWiFiFrquency5GhzCommand added in v0.5.0

func NewWiFiFrquency5GhzCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewWiFiFrquency5GhzCommand creates a new command to invoke the Hub WiFiFrquency5GhzCommand function

func NewWiFiSSIDCommand added in v0.4.0

func NewWiFiSSIDCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewWiFiSSIDCommand creates a new command to invoke the Hub WiFiSSID function

func NewWiFiSecurityModeCommand added in v0.4.0

func NewWiFiSecurityModeCommand(authenticatingCommand *GenericCommand) *AuthenticationRequiringCommand

NewWiFiSecurityModeCommand creates a new command to invoke the Hub WiFiSecurityMode function

func (*AuthenticationRequiringCommand) ExecuteLifecylce

func (c *AuthenticationRequiringCommand) ExecuteLifecylce(args []string)

ExecuteLifecylce runs the command execution lifecycle

type Command

type Command interface {
	Execute(context *CommandContext)
	ExecuteLifecylce(args []string)
	GetName() string
	Usage()
	Validate(context *CommandContext) bool
}

Command is an interface that defines a Hub CLI Command

type CommandContext added in v0.4.0

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

CommandContext encapsulates the state of a command execution lifecycle

func (*CommandContext) GetBooleanArg added in v0.4.0

func (c *CommandContext) GetBooleanArg(index int) (result bool, err error)

GetBooleanArg returns a bool cli command argument at the specified index

func (*CommandContext) GetIntArg added in v0.4.0

func (c *CommandContext) GetIntArg(index int) (result int, err error)

GetIntArg returns an int cli command argument at the specified index

func (*CommandContext) GetResult added in v0.4.0

func (c *CommandContext) GetResult() interface{}

GetResult returns the result of the command execution lifecycle

func (*CommandContext) GetStringArg added in v0.4.0

func (c *CommandContext) GetStringArg(index int) (result string)

GetStringArg returns a string cli command argument at the specified index

func (*CommandContext) HasResult added in v0.4.0

func (c *CommandContext) HasResult() bool

HasResult returns whether any step within the command execution returned a valid response

func (*CommandContext) IsError added in v0.4.0

func (c *CommandContext) IsError() bool

IsError returns whether any step within the command execution lifecycle encountered an error

func (*CommandContext) ReadLine added in v0.6.0

func (c *CommandContext) ReadLine(prompt string) (result string, err error)

ReadLine reads a line from the command CLI

func (*CommandContext) ReadPassword added in v0.6.0

func (c *CommandContext) ReadPassword(prompt string) (result string, err error)

ReadPassword reads a password string from the command CLI

func (*CommandContext) SetResult added in v0.4.0

func (c *CommandContext) SetResult(result interface{}, err error)

SetResult sets the result of the command execution lifecycle

type CommandLineParser

type CommandLineParser struct {
	Commands []Command
	Args     []string
}

CommandLineParser is a representation of a command line parser engine

func NewCommandLineParser

func NewCommandLineParser(commands []Command, args []string) *CommandLineParser

NewCommandLineParser creates a new CommandLineParser

func (*CommandLineParser) Parse

func (c *CommandLineParser) Parse() (result bool, err error)

Parse parses command line arguments

func (*CommandLineParser) PrintUsage

func (c *CommandLineParser) PrintUsage()

PrintUsage prints the CLI usage message

type GenericCommand

type GenericCommand struct {
	Name        string
	Description string
	ArgNames    []string
	ArgTypes    []string
	PreExec     func(context *CommandContext)
	Exec        func(context *CommandContext)
	PostExec    func(context *CommandContext)
}

GenericCommand defines a Hub CLI command that does not require authentication prior to execution

func NewAboutCommand added in v0.4.0

func NewAboutCommand() *GenericCommand

NewAboutCommand creates a new command to output information about the homehub-cli

func NewEnableDebugCommand added in v0.4.0

func NewEnableDebugCommand() *GenericCommand

NewEnableDebugCommand creates a new command to invoke the Hub EnableDebug function

func NewLoginCommand added in v0.4.0

func NewLoginCommand() *GenericCommand

NewLoginCommand creates a new command to invoke the Hub Login function

func (*GenericCommand) Execute

func (c *GenericCommand) Execute(context *CommandContext)

Execute executes the command

func (*GenericCommand) ExecuteLifecylce

func (c *GenericCommand) ExecuteLifecylce(args []string)

ExecuteLifecylce runs the command execution lifecycle

func (*GenericCommand) Explain added in v0.4.0

func (c *GenericCommand) Explain()

Explain prints an explanatory usage message for the command

func (*GenericCommand) GetName

func (c *GenericCommand) GetName() string

GetName returns the name of the command

func (*GenericCommand) Usage added in v0.4.0

func (c *GenericCommand) Usage()

Usage prints the usage statement for the command

func (*GenericCommand) Validate

func (c *GenericCommand) Validate(context *CommandContext) bool

Validate validates that the correct number of arguments were passed to the command

Jump to

Keyboard shortcuts

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