core

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = "v1"
)

Variables

This section is empty.

Functions

func Bind

func Bind(cmd *cobra.Command, command Command, options BindOptions)

func FormatCommandError added in v0.13.0

func FormatCommandError(err error) error

func OrganizationDomainType added in v0.17.0

func OrganizationDomainType() openapi_client.AuthorizationDomainType

OrganizationDomainType returns the authorization domain type used for all organization-scoped CLI requests. Packages should use this instead of referencing the openapi_client enum directly so the scoping rule lives in one place.

func ParseIntegrationScopedName

func ParseIntegrationScopedName(name string) (string, string, bool)

func ParseYamlResourceHeaders

func ParseYamlResourceHeaders(raw []byte) (string, string, error)

func ResolveCanvasID added in v0.9.0

func ResolveCanvasID(ctx CommandContext, canvasID string) (string, error)

func ResolveOrganizationID added in v0.15.0

func ResolveOrganizationID(ctx CommandContext) (string, error)

func SplitUserIdentifier added in v0.17.0

func SplitUserIdentifier(positional string, emailFlag string) (string, string, error)

SplitUserIdentifier picks between a user id and a user email based on either a positional argument or a --email flag. A positional containing "@" is treated as an email, so CLI commands can accept either form in the positional slot.

Returns (userID, userEmail, error). Exactly one of userID/userEmail is non-empty on success when an identifier was provided. Both empty means no identifier was given. An error is returned when both a positional and an explicit --email flag were supplied (ambiguous).

Types

type BindOptions

type BindOptions struct {
	NewAPIClient        func() *openapi_client.APIClient
	NewConfigContext    func() ConfigContext
	DefaultOutputFormat func() string
}

type Command

type Command interface {
	Execute(ctx CommandContext) error
}

type CommandContext

type CommandContext struct {
	Context  context.Context
	Cmd      *cobra.Command
	Args     []string
	Logger   *log.Entry
	API      *openapi_client.APIClient
	Renderer Renderer
	Config   ConfigContext
}

func NewCommandContext

func NewCommandContext(cmd *cobra.Command, args []string, options BindOptions) (CommandContext, error)

func (CommandContext) IsInteractive added in v0.14.0

func (c CommandContext) IsInteractive() bool

IsInteractive returns true when stdin is a terminal, meaning the user can respond to interactive prompts.

type ConfigContext added in v0.9.0

type ConfigContext interface {
	GetActiveCanvas() string
	SetActiveCanvas(canvasID string) error
}

* Interface that allows commands to access * and update the current configuration context.

type OutputFormat

type OutputFormat string
const (
	OutputFormatText OutputFormat = "text"
	OutputFormatJSON OutputFormat = "json"
	OutputFormatYAML OutputFormat = "yaml"
)

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

func NewRenderer

func NewRenderer(rawFormat string, stdout io.Writer) (Renderer, error)

func (Renderer) Format

func (r Renderer) Format() OutputFormat

func (Renderer) IsText

func (r Renderer) IsText() bool

func (Renderer) Render

func (r Renderer) Render(value any) error

func (Renderer) RenderText

func (r Renderer) RenderText(render func(io.Writer) error) error

Jump to

Keyboard shortcuts

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