Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 4c7141a

Browse files
committed
fix: rename envs to workspaces
Fix a few stray uses of the legacy "environments" terminology (envs) and replace it with "workspaces."
1 parent a430ef6 commit 4c7141a

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

docs/coder_workspaces_create-from-config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ coder workspaces create-from-config [flags]
1414

1515
```
1616
# create a new workspace from git repository
17-
coder envs create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
18-
coder envs create-from-config --name="dev-env" -f coder.yaml
17+
coder workspaces create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
18+
coder workspaces create-from-config --name="dev-env" --filepath coder.yaml
1919
```
2020

2121
### Options

docs/coder_workspaces_edit-from-config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ coder workspaces edit-from-config [flags]
1414

1515
```
1616
# edit a new workspace from git repository
17-
coder envs edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
18-
coder envs edit-from-config dev-env -f coder.yaml
17+
coder workspaces edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
18+
coder workspaces edit-from-config dev-env --filepath coder.yaml
1919
```
2020

2121
### Options

internal/cmd/workspaces.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -542,22 +542,22 @@ func selectOrg(needle string, haystack []coder.Organization) (*coder.Organizatio
542542
// If `update` is true, the update command is returned. If false, the create command.
543543
func workspaceFromConfigCmd(update bool) *cobra.Command {
544544
var (
545-
ref string
546-
repo string
547-
follow bool
548-
filepath string
549-
org string
550-
providerName string
551-
envName string
545+
ref string
546+
repo string
547+
follow bool
548+
filepath string
549+
org string
550+
providerName string
551+
workspaceName string
552552
)
553553

554554
run := func(cmd *cobra.Command, args []string) error {
555555
ctx := cmd.Context()
556556

557557
// Update requires the env name, and the name should be the first argument.
558558
if update {
559-
envName = args[0]
560-
} else if envName == "" {
559+
workspaceName = args[0]
560+
} else if workspaceName == "" {
561561
// Create takes the name as a flag, and it must be set
562562
return clog.Error("Must provide a workspace name.",
563563
clog.BlankLine,
@@ -581,17 +581,17 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
581581
}
582582

583583
// This is the env to be updated/created
584-
var env *coder.Workspace
584+
var workspace *coder.Workspace
585585

586586
// OrgID is the org where the template and env should be created.
587587
// If we are updating an env, use the orgID from the workspace.
588588
var orgID string
589589
if update {
590-
env, err = findWorkspace(ctx, client, envName, coder.Me)
590+
workspace, err = findWorkspace(ctx, client, workspaceName, coder.Me)
591591
if err != nil {
592592
return handleAPIError(err)
593593
}
594-
orgID = env.OrganizationID
594+
orgID = workspace.OrganizationID
595595
} else {
596596
var userOrg *coder.Organization
597597
// Select org in list or use default
@@ -637,16 +637,16 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
637637
}
638638

639639
if update {
640-
err = client.EditWorkspace(ctx, env.ID, coder.UpdateWorkspaceReq{
640+
err = client.EditWorkspace(ctx, workspace.ID, coder.UpdateWorkspaceReq{
641641
TemplateID: &version.TemplateID,
642642
})
643643
} else {
644-
env, err = client.CreateWorkspace(ctx, coder.CreateWorkspaceRequest{
644+
workspace, err = client.CreateWorkspace(ctx, coder.CreateWorkspaceRequest{
645645
OrgID: orgID,
646646
TemplateID: version.TemplateID,
647647
ResourcePoolID: provider.ID,
648648
Namespace: provider.DefaultNamespace,
649-
Name: envName,
649+
Name: workspaceName,
650650
})
651651
}
652652
if err != nil {
@@ -655,15 +655,15 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
655655

656656
if follow {
657657
clog.LogSuccess("creating workspace...")
658-
if err := trailBuildLogs(ctx, client, env.ID); err != nil {
658+
if err := trailBuildLogs(ctx, client, workspace.ID); err != nil {
659659
return err
660660
}
661661
return nil
662662
}
663663

664664
clog.LogSuccess("creating workspace...",
665665
clog.BlankLine,
666-
clog.Tipf(`run "coder envs watch-build %s" to trail the build logs`, env.Name),
666+
clog.Tipf(`run "coder workspaces watch-build %s" to see build logs`, workspace.Name),
667667
)
668668
return nil
669669
}
@@ -676,8 +676,8 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
676676
Long: "Edit an existing Coder workspace using a Workspaces As Code template.",
677677
Args: cobra.ExactArgs(1),
678678
Example: `# edit a new workspace from git repository
679-
coder envs edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
680-
coder envs edit-from-config dev-env -f coder.yaml`,
679+
coder workspaces edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
680+
coder workspaces edit-from-config dev-env --filepath coder.yaml`,
681681
RunE: run,
682682
}
683683
} else {
@@ -686,12 +686,12 @@ coder envs edit-from-config dev-env -f coder.yaml`,
686686
Short: "create a new workspace from a template",
687687
Long: "Create a new Coder workspace using a Workspaces As Code template.",
688688
Example: `# create a new workspace from git repository
689-
coder envs create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
690-
coder envs create-from-config --name="dev-env" -f coder.yaml`,
689+
coder workspaces create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
690+
coder workspaces create-from-config --name="dev-env" --filepath coder.yaml`,
691691
RunE: run,
692692
}
693693
cmd.Flags().StringVar(&providerName, "provider", "", "name of Workspace Provider with which to create the workspace")
694-
cmd.Flags().StringVar(&envName, "name", "", "name of the workspace to be created")
694+
cmd.Flags().StringVar(&workspaceName, "name", "", "name of the workspace to be created")
695695
cmd.Flags().StringVarP(&org, "org", "o", "", "name of the organization the workspace should be created under.")
696696
// Ref and repo-url can only be used for create
697697
cmd.Flags().StringVarP(&ref, "ref", "", "master", "git reference to pull template from. May be a branch, tag, or commit hash.")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy