Files
coder/cli/workspaces.go
T
Kyle Carberry 82dfd6c72f feat: Add UI for awaiting agent connections (#578)
* feat: Add stage to build logs

This adds a stage property to logs, and refactors the job logs
cliui.

It also adds tests to the cliui for build logs!

* feat: Add stage to build logs

This adds a stage property to logs, and refactors the job logs
cliui.

It also adds tests to the cliui for build logs!

* feat: Add config-ssh and tests for resiliency

* Rename "Echo" test to "ImmediateExit"

* Fix Terraform resource agent association

* Fix logs post-cancel

* Fix select on Windows

* Remove terraform init logs

* Move timer into it's own loop

* Fix race condition in provisioner jobs

* Fix requested changes
2022-03-28 19:19:28 -05:00

45 lines
1.0 KiB
Go

package cli
import (
"strings"
"github.com/spf13/cobra"
)
func workspaces() *cobra.Command {
cmd := &cobra.Command{
Use: "workspaces",
Aliases: []string{"ws"},
}
cmd.AddCommand(workspaceAgent())
cmd.AddCommand(workspaceCreate())
cmd.AddCommand(workspaceDelete())
cmd.AddCommand(workspaceList())
cmd.AddCommand(workspaceShow())
cmd.AddCommand(workspaceStop())
cmd.AddCommand(workspaceStart())
cmd.AddCommand(ssh())
cmd.AddCommand(workspaceUpdate())
return cmd
}
func validArgsWorkspaceName(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
client, err := createClient(cmd)
if err != nil {
return nil, cobra.ShellCompDirectiveError
}
workspaces, err := client.WorkspacesByUser(cmd.Context(), "")
if err != nil {
return nil, cobra.ShellCompDirectiveError
}
names := make([]string, 0)
for _, workspace := range workspaces {
if !strings.HasPrefix(workspace.Name, toComplete) {
continue
}
names = append(names, workspace.Name)
}
return names, cobra.ShellCompDirectiveDefault
}