Documentation
¶
Index ¶
- Constants
- Variables
- func CheckWithMessage(err error, message string)
- func ContextSelector(context ConfigContext) string
- func DefaultClient() *openapi_client.APIClient
- func Exit(code int)
- func GetAPIToken() string
- func GetAPIURL() string
- func GetOutputFormat() string
- func NewAPIClient(config *ClientConfig) *openapi_client.APIClient
- func NewCurrentContext(context ConfigContext) core.ConfigContext
- func NewEnvironmentContext(context ConfigContext) core.ConfigContext
- func PrintUpdateNotice()
- func SaveContexts(contexts []ConfigContext) error
- func ShouldStartUpdateCheck(args []string) bool
- func StartUpdateCheck()
- func ValidateEnvironmentContext() error
- func WriteConfig() error
- type ClientConfig
- type ConfigContext
- func GetContexts() []ConfigContext
- func GetCurrentContext() (ConfigContext, bool)
- func GetEnvironmentContext() (ConfigContext, bool)
- func SwitchContext(baseURL, org string) (*ConfigContext, error)
- func SwitchContextByOrganization(orgOrID, urlFilter string) (*ConfigContext, error)
- func UpsertContext(context ConfigContext) (ConfigContext, error)
- type ConnectCommand
- type ContextCommand
- type ContextsCommand
- type CurrentContext
Constants ¶
const ( EnvURL = "SUPERPLANE_URL" EnvToken = "SUPERPLANE_TOKEN" )
const ( DefaultAPIURL = "http://localhost:8000" ConfigKeyOutput = "output" ConfigKeyContexts = "contexts" ConfigKeyCurrentContext = "currentContext" )
Variables ¶
var OutputFormat string
var RootCmd = &cobra.Command{ Use: "superplane", Short: "SuperPlane command line interface", Long: "SuperPlane CLI - Command line interface for the SuperPlane API\n\n" + core.AgentSkillsHelp(), PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if !Verbose { log.SetOutput(io.Discard) } return ValidateEnvironmentContext() }, }
var Verbose bool
var Version = "dev"
Version is set at build time via -ldflags. Defaults to "dev" for development builds.
Functions ¶
func CheckWithMessage ¶
Checks if an error is present.
If it is present, it displays the provided message and exits with status 1.
func ContextSelector ¶ added in v0.9.0
func ContextSelector(context ConfigContext) string
func DefaultClient ¶
func DefaultClient() *openapi_client.APIClient
func GetAPIToken ¶
func GetAPIToken() string
func GetOutputFormat ¶
func GetOutputFormat() string
func NewAPIClient ¶
func NewAPIClient(config *ClientConfig) *openapi_client.APIClient
func NewCurrentContext ¶ added in v0.9.0
func NewCurrentContext(context ConfigContext) core.ConfigContext
func NewEnvironmentContext ¶ added in v0.21.0
func NewEnvironmentContext(context ConfigContext) core.ConfigContext
func PrintUpdateNotice ¶ added in v0.14.0
func PrintUpdateNotice()
PrintUpdateNotice prints an upgrade notice to stderr if a newer version is available. It waits at most 1 second for the background check to finish.
func SaveContexts ¶ added in v0.9.0
func SaveContexts(contexts []ConfigContext) error
func ShouldStartUpdateCheck ¶ added in v0.14.0
func StartUpdateCheck ¶ added in v0.14.0
func StartUpdateCheck()
StartUpdateCheck begins an async check for a newer CLI version. It is a no-op for dev builds.
func ValidateEnvironmentContext ¶ added in v0.21.0
func ValidateEnvironmentContext() error
func WriteConfig ¶ added in v0.9.0
func WriteConfig() error
Types ¶
type ClientConfig ¶
func NewClientConfig ¶
func NewClientConfig() *ClientConfig
type ConfigContext ¶ added in v0.9.0
type ConfigContext struct {
URL string `json:"url" yaml:"url"`
Organization string `json:"organization" yaml:"organization"`
OrganizationID string `json:"organizationId,omitempty" yaml:"organizationId,omitempty"`
APIToken string `json:"apiToken" yaml:"apiToken"`
Canvas *string `json:"canvas,omitempty" yaml:"canvas,omitempty"`
}
func GetContexts ¶ added in v0.9.0
func GetContexts() []ConfigContext
func GetCurrentContext ¶ added in v0.9.0
func GetCurrentContext() (ConfigContext, bool)
func GetEnvironmentContext ¶ added in v0.21.0
func GetEnvironmentContext() (ConfigContext, bool)
func SwitchContext ¶ added in v0.20.0
func SwitchContext(baseURL, org string) (*ConfigContext, error)
SwitchContext makes the context identified by (baseURL, org) current. The org argument matches on organization ID first and then on organization name.
func SwitchContextByOrganization ¶ added in v0.20.0
func SwitchContextByOrganization(orgOrID, urlFilter string) (*ConfigContext, error)
SwitchContextByOrganization sets the current context using organization id or name across saved installations. When urlFilter is non-empty, only contexts at that base URL are considered (so multiple matches are always same-installation duplicates, never cross-installation ambiguity). Multiple matches on different base URLs without urlFilter returns an error that lists installations and suggests --url.
func UpsertContext ¶ added in v0.9.0
func UpsertContext(context ConfigContext) (ConfigContext, error)
type ConnectCommand ¶ added in v0.9.0
type ConnectCommand struct{}
func (*ConnectCommand) Execute ¶ added in v0.9.0
func (c *ConnectCommand) Execute(ctx core.CommandContext) error
type ContextCommand ¶ added in v0.20.0
type ContextCommand struct{}
func (*ContextCommand) Execute ¶ added in v0.20.0
func (c *ContextCommand) Execute(ctx core.CommandContext) error
type ContextsCommand ¶ added in v0.9.0
type ContextsCommand struct{}
func (*ContextsCommand) Execute ¶ added in v0.9.0
func (c *ContextsCommand) Execute(ctx core.CommandContext) error
type CurrentContext ¶ added in v0.9.0
type CurrentContext struct {
// contains filtered or unexported fields
}
* Implementation of the core.ConfigContext interface, * which uses the current context as the source for operations..
func (*CurrentContext) GetActiveCanvas ¶ added in v0.9.0
func (c *CurrentContext) GetActiveCanvas() string
func (*CurrentContext) GetURL ¶ added in v0.21.0
func (c *CurrentContext) GetURL() string
func (*CurrentContext) SetActiveCanvas ¶ added in v0.9.0
func (c *CurrentContext) SetActiveCanvas(canvasID string) error