snmp

package
v0.0.0-...-2feb83d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package snmp implements the 'agent snmp' subcommand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commands

func Commands(globalParams *command.GlobalParams) []*cobra.Command

Commands returns a slice of subcommands for the 'agent' command.

Types

type OptPairs

type OptPairs[T any] []struct {
	// contains filtered or unexported fields
}

OptPairs is just a useful type alias to avoid writing this out multiple times.

type Options

type Options[T any] struct {
	Options map[string]T
	Order   []string
}

Options represents an ordered map of choices

func NewOptions

func NewOptions[T any](pairs OptPairs[T]) Options[T]

NewOptions creates a new Options object from a set of pairs. We don't just create one directly from a map because map iteration order is random.

func (Options[T]) Flag

func (o Options[T]) Flag(target *string) OptionsFlag[T]

Flag creates a flag using these options and storing the selected choice in target.

func (Options[T]) OptsStr

func (o Options[T]) OptsStr() string

OptsStr provides a '|'-delimited list of all nonempty options.

func (Options[T]) TypedFlag

func (o Options[T]) TypedFlag(target *string, typeName string) OptionsFlag[T]

TypedFlag is the same as Flag but lets you customize how the type of flag is shown in the help.

type OptionsFlag

type OptionsFlag[T any] struct {
	// contains filtered or unexported fields
}

OptionsFlag is an implementation of pflag.Value that complains when set to an invalid option.

func (OptionsFlag[T]) Set

func (a OptionsFlag[T]) Set(p string) error

Set sets the value, returning an error if the given choice isn't valid.

func (OptionsFlag[T]) String

func (a OptionsFlag[T]) String() string

String returns a string representation of this value.

func (OptionsFlag[T]) Type

func (a OptionsFlag[T]) Type() string

Type is how the value is represented in the auto-generated help.

Jump to

Keyboard shortcuts

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