cmd

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EmptyArgsUsage = " "

EmptyArgsUsage is used to specify that the command arguments section shouldn't be displayed in the help text. This is a workaround to avoid having to change the entire template.

Variables

View Source
var AvailableOutputFormatStrings = []string{string(OutputFormatTable), string(OutputFormatJSON)}

AvailableOutputFormatStrings returns all the output formats available to users.

View Source
var FlagLimit = &cli.UintFlag{
	Name:  "limit",
	Usage: "[Optional] Limit the number of items to return",
}

FlagLimit is a flag used for limiting the number of items to return.

View Source
var FlagNoColor = &cli.BoolFlag{
	Name:  "no-color",
	Usage: "Disables coloring for the console output. Automatically enabled when the output is not a terminal.",
}

FlagNoColor disables coloring in the console output.

View Source
var FlagOutputFormat = &cli.StringFlag{
	Name:    "output",
	Aliases: []string{"o"},
	Usage:   fmt.Sprintf("Output `format`. Allowed values: %s", strings.Join(AvailableOutputFormatStrings, ", ")),
	Value:   string(OutputFormatTable),
}

FlagOutputFormat allows users to change the output format of commands that support it.

View Source
var FlagSearch = &cli.StringFlag{
	Name:  "search",
	Usage: "[Optional] Performs a full-text search.",
}

FlagSearch is a flag used for performing a full-text search.

View Source
var FlagShowLabels = &cli.BoolFlag{
	Name:  "show-labels",
	Usage: "[Optional] Indicates that labels should be printed when outputting data in the table format",
}

FlagShowLabels is a flag used for indicating that labels should be printed when outputting data in the table format.

Functions

func HandleNoColor added in v0.9.0

func HandleNoColor(ctx *cli.Context) error

HandleNoColor handles FlagNoColor to disable console coloring.

func HumanizeAuditTrailResourceType added in v1.9.0

func HumanizeAuditTrailResourceType(resourceType string) string

func HumanizeBlueprintState added in v1.6.0

func HumanizeBlueprintState(state string) string

func HumanizeGitHash added in v0.12.0

func HumanizeGitHash(hash string) string

HumanizeGitHash shortens a Git hash to make it more readable.

func HumanizePolicyType added in v0.7.1

func HumanizePolicyType(policyType string) string

HumanizePolicyType converts the GraphQL PolicyType enum to a human readable string.

func HumanizeUnixSeconds added in v1.6.0

func HumanizeUnixSeconds(seconds int) string

func HumanizeVCSProvider added in v0.7.1

func HumanizeVCSProvider(provider string) string

HumanizeVCSProvider converts the GraphQL VCSProvider enum to a human readable string.

func OutputJSON

func OutputJSON(v interface{}) error

OutputJSON outputs the specified object as JSON.

func OutputTable

func OutputTable(data [][]string, hasHeader bool) error

OutputTable outputs the specified data as a table.

func PerformAllBefore added in v0.9.0

func PerformAllBefore(actions ...cli.BeforeFunc) cli.BeforeFunc

PerformAllBefore wraps all the specified BeforeFuncs into a single BeforeFunc.

Types

type OutputFormat

type OutputFormat string

OutputFormat defines the way that the results of a command are output to the user.

const (
	// OutputFormatTable represents the output formatted in a table.
	OutputFormatTable OutputFormat = "table"

	// OutputFormatJSON represents the output formatted as JSON.
	OutputFormatJSON OutputFormat = "json"
)

func GetOutputFormat

func GetOutputFormat(cliContext *cli.Context) (OutputFormat, error)

GetOutputFormat gets the selected output format based on the CLI args.

Jump to

Keyboard shortcuts

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