util

package
v0.6.317 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAnyWorkspaceByIDOrNameInActiveOrgErr added in v0.6.76

func GetAnyWorkspaceByIDOrNameInActiveOrgErr(storeQ GetWorkspaceByNameOrIDErrStore, workspaceNameOrID string) (*entity.Workspace, error)

func GetClassIDString added in v0.6.209

func GetClassIDString(classID string) string

func GetInstanceNames added in v0.6.317

func GetInstanceNames(args []string) ([]string, error)

GetInstanceNames gets instance names from args or stdin (supports piping) Returns error if no names are provided

func GetInstanceNamesWithPipeInfo added in v0.6.317

func GetInstanceNamesWithPipeInfo(args []string) ([]string, bool)

GetInstanceNamesWithPipeInfo gets instance names from args or stdin and returns whether stdin was piped. Useful when you need to know if input came from a pipe vs args.

func GetInstanceString added in v0.6.209

func GetInstanceString(w entity.Workspace) string

func GetUserWorkspaceByNameOrIDErr added in v0.6.66

func GetUserWorkspaceByNameOrIDErr(storeQ GetWorkspaceByNameOrIDErrStore, workspaceNameOrID string) (*entity.Workspace, error)

func IsStdinPiped added in v0.6.317

func IsStdinPiped() bool

IsStdinPiped returns true if stdin is being piped from another command

func IsStdoutPiped added in v0.6.317

func IsStdoutPiped() bool

IsStdoutPiped returns true if stdout is being piped to another command Enables command chaining like: brev ls | grep RUNNING | brev stop

func PollUntil added in v0.6.317

func PollUntil(s *spinner.Spinner, wsid string, state string, pollingStore WorkspacePollingStore, waitMsg string, timeout time.Duration) error

PollUntil polls the workspace status until it matches the desired state or times out

func StartWorkspaceIfStopped added in v0.6.317

func StartWorkspaceIfStopped(t *terminal.Terminal, s *spinner.Spinner, tstore WorkspaceStartStore, wsIDOrName string, workspace *entity.Workspace, timeout time.Duration) error

StartWorkspaceIfStopped starts a workspace and waits for it to be running

func WaitForSSHToBeAvailable added in v0.6.317

func WaitForSSHToBeAvailable(sshAlias string, s *spinner.Spinner) error

WaitForSSHToBeAvailable polls until an SSH connection can be established

Types

type GetWorkspaceByNameOrIDErrStore

type GetWorkspaceByNameOrIDErrStore interface {
	GetActiveOrganizationOrDefault() (*entity.Organization, error)
	GetWorkspaceByNameOrID(orgID string, nameOrID string) ([]entity.Workspace, error)
	GetCurrentUser() (*entity.User, error)
}

type MakeWorkspaceWithMetaStore

type MakeWorkspaceWithMetaStore interface {
	GetWorkspaceMetaData(workspaceID string) (*entity.WorkspaceMetaData, error)
}

type WorkspacePollingStore added in v0.6.317

type WorkspacePollingStore interface {
	GetWorkspace(workspaceID string) (*entity.Workspace, error)
}

WorkspacePollingStore is the minimal interface needed for polling workspace state

type WorkspaceStartStore added in v0.6.317

type WorkspaceStartStore interface {
	GetWorkspaceByNameOrIDErrStore
	WorkspacePollingStore
	StartWorkspace(workspaceID string) (*entity.Workspace, error)
}

WorkspaceStartStore is the interface needed for starting stopped workspaces

Jump to

Keyboard shortcuts

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