Documentation ¶
Index ¶
- Constants
- Variables
- func HandleNoColor(ctx *cli.Context) error
- func HumanizeBlueprintState(state string) string
- func HumanizeGitHash(hash string) string
- func HumanizePolicyType(policyType string) string
- func HumanizeUnixSeconds(seconds int) string
- func HumanizeVCSProvider(provider string) string
- func OutputJSON(v interface{}) error
- func OutputTable(data [][]string, hasHeader bool) error
- func PerformAllBefore(actions ...cli.BeforeFunc) cli.BeforeFunc
- type OutputFormat
Constants ¶
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 ¶
var AvailableOutputFormatStrings = []string{string(OutputFormatTable), string(OutputFormatJSON)}
AvailableOutputFormatStrings returns all the output formats available to users.
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.
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.
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.
var FlagSearch = &cli.StringFlag{
Name: "search",
Usage: "[Optional] Performs a full-text search.",
}
FlagSearch is a flag used for performing a full-text search.
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 HumanizeBlueprintState ¶ added in v1.6.0
func HumanizeGitHash ¶ added in v0.12.0
HumanizeGitHash shortens a Git hash to make it more readable.
func HumanizePolicyType ¶ added in v0.7.1
HumanizePolicyType converts the GraphQL PolicyType enum to a human readable string.
func HumanizeUnixSeconds ¶ added in v1.6.0
func HumanizeVCSProvider ¶ added in v0.7.1
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 ¶
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.