command

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package command implements the common commands of the csharg CLI.

Index

Constants

View Source
const (
	// PodListTemplate defines the custom columns when listing only pods.
	PodListTemplate = "POD:{.Name}"
	// PodWideListTemplate defines the custom columns when listing only pods in
	// --wide mode.
	PodWideListTemplate = "POD:{.Name},NODE:{.NodeName}"

	// TargetListTemplate defines the custom columns when listing all types of
	// capture targets.
	TargetListTemplate = "TARGET:{.Name},TYPE:{.Type},NODE:{.NodeName}"
	// TargetWideListTemplate is like TargetListTemplate, but additionally tacks
	// on a column listing the capture service pod names.
	TargetWideListTemplate = "TARGET:{.Name},TYPE:{.Type},NODE:{.NodeName},SERVICE:{.CaptureService}"

	// NameListTemplate for handling "-o name" and only showing a custom "name"
	// column; this template should be used with no headers shown, as kubectl
	// and others do.
	NameListTemplate = "NAME:{.Name}"
)

Builtin custom-columns templates

View Source
const ClientGroup = "sharktank"

ClientGroup is the name of an annotation value for flags that should be mutually exclusive for specifying capture service client endpoint information.

View Source
const MutualFlagGroupAnnotation = "mutually-exclusive-group"

Flag annotation for grouping mutually exclusive flags. Due to the open-ended plugin architecture of csharg we cannot directly use cobra's MarkFlagsMutuallyExclusive in plugins, but instead plugin need to annotate their flags and we then gather the groups with their flag members in order to issue MarkFlagsMutuallyExclusive as necessary.

Variables

View Source
var BearerToken string

BearerToken specifies an optional user-supplied bearer token for authentication to be used with either the service URL.

View Source
var ReqTimeout time.Duration

ReqTimeout specifies the length of time to wait before giving up on a single server request.

Functions

func Annotate

func Annotate(fs *pflag.FlagSet, flagname, key, ann string)

Annotate annotates the flag identified by name with the key=ann.

func DebugBeforeCommand

func DebugBeforeCommand(*cobra.Command) error

DebugBeforeCommand enables debug logging when requested via the “--debug” flag.

func DebugSetupCLI

func DebugSetupCLI(cmd *cobra.Command)

DebugSetupCLI registers the “--debug” CLI flag.

func ListSetupCLI

func ListSetupCLI(cmd *cobra.Command)

ListSetupCLI adds the “list” command.

func NewSharkTank

func NewSharkTank() (csharg.SharkTank, error)

NewSharkTank returns a suitable packetflix capture service client by asking the registered client factories one after another until the first one returns a client or an error.

func OptionsSetupCLI

func OptionsSetupCLI(cmd *cobra.Command)

OptionsSetupCLI adds the "option" command.

func SetupCLI

func SetupCLI() *cobra.Command

SetupCLI registers the global ("persistent") CLI flags, as well as the (sub)commands. The individual commands are registered via a plugin-mechanism.

func VersionSetupCLI

func VersionSetupCLI(cmd *cobra.Command)

VersionSetupCLI adds the “version” command.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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