 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func HandleNoColor(ctx context.Context, cmd *cli.Command) (context.Context, error)
- func HumanizeAuditTrailResourceType(resourceType string) string
- 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
- func ResolveCommands(instanceVersion SpaceliftInstanceVersion, allCommands []Command) []*cli.Command
- type Command
- type OutputFormat
- type SpaceliftInstanceType
- type SpaceliftInstanceVersion
- type SupportedVersion
- type VersionedCommand
Constants ¶
const ( // SupportedVersionAll indicates that the command is available for all versions of Spacelift. SupportedVersionAll = "all" // SupportedVersionLatest indicates that the command is supported for SaaS, and will be supported // by Self-Hosted after the next Self-Hosted release. SupportedVersionLatest = "latest" )
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
HandleNoColor handles FlagNoColor to disable console coloring.
func HumanizeAuditTrailResourceType ¶ added in v1.9.0
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.
func ResolveCommands ¶ added in v1.12.0
func ResolveCommands(instanceVersion SpaceliftInstanceVersion, allCommands []Command) []*cli.Command
ResolveCommands finds the set of command versions from allCommands and their subcommands that are available based on the specified Spacelift instance version.
Types ¶
type Command ¶ added in v1.12.0
type Command struct {
	Name     string
	Usage    string
	Category string
	// Versions defines the available versions for the command.
	Versions []VersionedCommand
	// Subcommands gets the list of subcommands that support the specified version.
	Subcommands []Command
}
    func (Command) FindLatestSupportedVersion ¶ added in v1.12.0
func (c Command) FindLatestSupportedVersion(instanceVersion SpaceliftInstanceVersion) *VersionedCommand
FindLatestSupportedVersion finds the latest supported version of the specified command. It returns nil if no version of the command is supported by the Spacelift instance.
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(cliCmd *cli.Command) (OutputFormat, error)
GetOutputFormat gets the selected output format based on the CLI args.
type SpaceliftInstanceType ¶ added in v1.12.0
type SpaceliftInstanceType uint
const ( // SpaceliftInstanceTypeUnknown indicates that we don't know what type of instance spacectl // is being used against. This can happen before a profile has been created or if the credentials // have expired. SpaceliftInstanceTypeUnknown SpaceliftInstanceType = iota // SpaceliftInstanceTypeSaaS indicates we're talking to Spacelift SaaS. SpaceliftInstanceTypeSaaS // SpaceliftInstanceTypeSelfHosted indicates we're talking to a Self-Hosted instance. SpaceliftInstanceTypeSelfHosted )
type SpaceliftInstanceVersion ¶ added in v1.12.0
type SpaceliftInstanceVersion struct {
	// InstanceType defines the type of instance we're connecting to.
	InstanceType SpaceliftInstanceType
	// Version indicates the Self-Hosted version we are communicating with. It will be nil for SaaS.
	Version *semver.Version
}
    func (SpaceliftInstanceVersion) SimplifiedVersion ¶ added in v1.12.0
func (v SpaceliftInstanceVersion) SimplifiedVersion() *semver.Version
SimplifiedVersion returns the version (if set) without the prerelease or metadata parts.
func (SpaceliftInstanceVersion) String ¶ added in v1.12.0
func (v SpaceliftInstanceVersion) String() string
String returns a string representation of the instance version.
type SupportedVersion ¶ added in v1.12.0
type SupportedVersion string
SupportedVersion is used to indicate what versions of Spacelift certain spacectl commands are compatible with.
type VersionedCommand ¶ added in v1.12.0
type VersionedCommand struct {
	// EarliestVersion indicates that the command needs at least the indicated Self-Hosted version
	// in order to work.
	//
	// - SupportedVersionAll - indicates that the command can be used for any Spacelift version (both SaaS and Self-Hosted).
	// - SupportedVersionLatest - indicates that the command can be used with SaaS, but will not be available to Self-Hosted until the next release.
	// - 1.2.3, 2.5.0, etc - indicates that the command can be used with SaaS, or a Self-Hosted version equal to or higher than the specified version.
	EarliestVersion SupportedVersion
	// The CLI command definition.
	Command *cli.Command
}