@@ -542,22 +542,22 @@ func selectOrg(needle string, haystack []coder.Organization) (*coder.Organizatio
542
542
// If `update` is true, the update command is returned. If false, the create command.
543
543
func workspaceFromConfigCmd (update bool ) * cobra.Command {
544
544
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
552
552
)
553
553
554
554
run := func (cmd * cobra.Command , args []string ) error {
555
555
ctx := cmd .Context ()
556
556
557
557
// Update requires the env name, and the name should be the first argument.
558
558
if update {
559
- envName = args [0 ]
560
- } else if envName == "" {
559
+ workspaceName = args [0 ]
560
+ } else if workspaceName == "" {
561
561
// Create takes the name as a flag, and it must be set
562
562
return clog .Error ("Must provide a workspace name." ,
563
563
clog .BlankLine ,
@@ -581,17 +581,17 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
581
581
}
582
582
583
583
// This is the env to be updated/created
584
- var env * coder.Workspace
584
+ var workspace * coder.Workspace
585
585
586
586
// OrgID is the org where the template and env should be created.
587
587
// If we are updating an env, use the orgID from the workspace.
588
588
var orgID string
589
589
if update {
590
- env , err = findWorkspace (ctx , client , envName , coder .Me )
590
+ workspace , err = findWorkspace (ctx , client , workspaceName , coder .Me )
591
591
if err != nil {
592
592
return handleAPIError (err )
593
593
}
594
- orgID = env .OrganizationID
594
+ orgID = workspace .OrganizationID
595
595
} else {
596
596
var userOrg * coder.Organization
597
597
// Select org in list or use default
@@ -637,16 +637,16 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
637
637
}
638
638
639
639
if update {
640
- err = client .EditWorkspace (ctx , env .ID , coder.UpdateWorkspaceReq {
640
+ err = client .EditWorkspace (ctx , workspace .ID , coder.UpdateWorkspaceReq {
641
641
TemplateID : & version .TemplateID ,
642
642
})
643
643
} else {
644
- env , err = client .CreateWorkspace (ctx , coder.CreateWorkspaceRequest {
644
+ workspace , err = client .CreateWorkspace (ctx , coder.CreateWorkspaceRequest {
645
645
OrgID : orgID ,
646
646
TemplateID : version .TemplateID ,
647
647
ResourcePoolID : provider .ID ,
648
648
Namespace : provider .DefaultNamespace ,
649
- Name : envName ,
649
+ Name : workspaceName ,
650
650
})
651
651
}
652
652
if err != nil {
@@ -655,15 +655,15 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
655
655
656
656
if follow {
657
657
clog .LogSuccess ("creating workspace..." )
658
- if err := trailBuildLogs (ctx , client , env .ID ); err != nil {
658
+ if err := trailBuildLogs (ctx , client , workspace .ID ); err != nil {
659
659
return err
660
660
}
661
661
return nil
662
662
}
663
663
664
664
clog .LogSuccess ("creating workspace..." ,
665
665
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 ),
667
667
)
668
668
return nil
669
669
}
@@ -673,25 +673,25 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
673
673
cmd = & cobra.Command {
674
674
Use : "edit-from-config" ,
675
675
Short : "change the template a workspace is tracking" ,
676
- Long : "Edit an existing Coder workspace using a Workspaces As Code template." ,
676
+ Long : "Edit an existing Coder workspace using a workspace template." ,
677
677
Args : cobra .ExactArgs (1 ),
678
678
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` ,
681
681
RunE : run ,
682
682
}
683
683
} else {
684
684
cmd = & cobra.Command {
685
685
Use : "create-from-config" ,
686
686
Short : "create a new workspace from a template" ,
687
- Long : "Create a new Coder workspace using a Workspaces As Code template." ,
687
+ Long : "Create a new Coder workspace using a workspace template." ,
688
688
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` ,
691
691
RunE : run ,
692
692
}
693
693
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" )
695
695
cmd .Flags ().StringVarP (& org , "org" , "o" , "" , "name of the organization the workspace should be created under." )
696
696
// Ref and repo-url can only be used for create
697
697
cmd .Flags ().StringVarP (& ref , "ref" , "" , "master" , "git reference to pull template from. May be a branch, tag, or commit hash." )
0 commit comments