internal

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package internal provides CLI command handling for tmhi-cli.

Index

Constants

View Source
const (
	ARCADYAN       string        = "ARCADYAN"
	NOK5G21        string        = "NOK5G21"
	DefaultTimeout time.Duration = 5 * time.Second
)

Gateway model constants.

View Source
const (
	ConfigAutoConfirm string = "yes"
	ConfigColor       string = "color"
	ConfigConfig      string = "config"
	ConfigDebug       string = "debug"
	ConfigDryRun      string = "dry-run"
	ConfigGateway     string = "gateway."
	ConfigIP          string = ConfigGateway + "ip"
	ConfigLogin       string = "login."
	ConfigModel       string = ConfigGateway + "model"
	ConfigPassword    string = ConfigLogin + "password"
	ConfigQuiet       string = "quiet"
	ConfigRetries     string = "retries"
	ConfigTimeout     string = "timeout"
	ConfigUsername    string = ConfigLogin + "username"
)

Configuration flag names.

Variables

View Source
var ErrInvalidConfig = errors.New("invalid configuration")

ErrInvalidConfig is returned when configuration validation fails.

View Source
var ErrUnknownGateway = errors.New("unknown gateway")

ErrUnknownGateway is returned when an unsupported gateway model is specified.

Functions

func Cmd added in v0.2.0

func Cmd(version string)

Cmd is the main entry point for the CLI application.

func Info added in v0.5.0

func Info(_ context.Context, _ *cli.Command) error

Info handles the info CLI command.

func Login added in v0.2.0

func Login(_ context.Context, _ *cli.Command) error

Login handles the login CLI command.

func Reboot added in v0.2.0

func Reboot(_ context.Context, cmd *cli.Command) error

Reboot handles the reboot CLI command.

func Req added in v0.5.0

func Req(_ context.Context, cmd *cli.Command) error

Req handles the req CLI command for custom HTTP requests.

func Signal added in v0.7.0

func Signal(_ context.Context, _ *cli.Command) error

Signal handles the signal CLI command.

func Status added in v0.6.0

func Status(_ context.Context, _ *cli.Command) error

Status handles the status CLI command.

Types

type Config added in v1.3.0

type Config struct {
	Model    string `validate:"required,oneof=ARCADYAN NOK5G21"`
	IP       string `validate:"required,hostname|ip"`
	Username string `validate:"required"`
	Password string
	Timeout  time.Duration `validate:"required,min=1s"`
	Retries  int           `validate:"min=0"`
	Debug    bool
	DryRun   bool
}

Config holds all configuration values for the CLI application.

func (*Config) Validate added in v1.3.0

func (c *Config) Validate() error

Validate validates the Config struct and returns formatted errors.

Jump to

Keyboard shortcuts

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