Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/cmd/copy/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type CopyStore interface {
StartWorkspace(workspaceID string) (*entity.Workspace, error)
GetWorkspace(workspaceID string) (*entity.Workspace, error)
GetCurrentUserKeys() (*entity.UserKeys, error)
GetAccessToken() (string, error)
}

func NewCmdCopy(t *terminal.Terminal, store CopyStore, noLoginStartStore CopyStore) *cobra.Command {
Expand Down Expand Up @@ -65,6 +66,9 @@ func NewCmdCopy(t *terminal.Terminal, store CopyStore, noLoginStartStore CopySto
}

func runCopyCommand(t *terminal.Terminal, cstore CopyStore, source, dest string, host bool) error {
if _, err := cstore.GetAccessToken(); err != nil {
return breverrors.WrapAndTrace(err)
}
workspaceNameOrID, remotePath, localPath, isUpload, err := parseCopyArguments(source, dest)
if err != nil {
return breverrors.WrapAndTrace(err)
Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/portforward/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type PortforwardStore interface {
refresh.RefreshStore
util.GetWorkspaceByNameOrIDErrStore
util.MakeWorkspaceWithMetaStore
GetAccessToken() (string, error)
}

func NewCmdPortForwardSSH(pfStore PortforwardStore, t *terminal.Terminal) *cobra.Command {
Expand Down Expand Up @@ -87,6 +88,9 @@ func isPortAlreadyAllocatedError(err error) bool {
}

func RunPortforward(t *terminal.Terminal, pfStore PortforwardStore, nameOrID string, portString string, useHost bool) error {
if _, err := pfStore.GetAccessToken(); err != nil {
return breverrors.WrapAndTrace(err)
}
localPort, remotePort, err := parsePortString(portString)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type ShellStore interface {
refresh.RefreshStore
GetOrganizations(options *store.GetOrganizationsOptions) ([]entity.Organization, error)
GetWorkspaces(organizationID string, options *store.GetWorkspacesOptions) ([]entity.Workspace, error)
GetAccessToken() (string, error)
}

func NewCmdShell(t *terminal.Terminal, store ShellStore, noLoginStartStore ShellStore) *cobra.Command {
Expand Down Expand Up @@ -80,6 +81,9 @@ func NewCmdShell(t *terminal.Terminal, store ShellStore, noLoginStartStore Shell
const pollTimeout = 10 * time.Minute

func runShellCommand(t *terminal.Terminal, sstore ShellStore, workspaceNameOrID string, host bool) error {
if _, err := sstore.GetAccessToken(); err != nil {
return breverrors.WrapAndTrace(err)
}
s := t.NewSpinner()
target, err := util.ResolveWorkspaceOrNode(sstore, workspaceNameOrID)
if err != nil {
Expand Down
Loading