Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e8dd97

Browse files
committed
use new org context
1 parent5c77a2a commit8e8dd97

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

‎cli/templatedelete.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
)
1616

1717
func (r*RootCmd)templateDelete()*serpent.Command {
18+
orgContext:=NewOrganizationContext()
1819
client:=new(codersdk.Client)
1920
cmd:=&serpent.Command{
2021
Use:"delete [name...]",
@@ -32,7 +33,7 @@ func (r *RootCmd) templateDelete() *serpent.Command {
3233
templates= []codersdk.Template{}
3334
)
3435

35-
organization,err:=CurrentOrganization(r,inv,client)
36+
organization,err:=orgContext.Selected(inv,client)
3637
iferr!=nil {
3738
returnerr
3839
}
@@ -81,6 +82,7 @@ func (r *RootCmd) templateDelete() *serpent.Command {
8182
returnnil
8283
},
8384
}
85+
orgContext.AttachOptions(cmd)
8486

8587
returncmd
8688
}

‎cli/templateedit.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
3636
requireActiveVersionbool
3737
deprecationMessagestring
3838
disableEveryonebool
39+
orgContext=NewOrganizationContext()
3940
)
4041
client:=new(codersdk.Client)
4142

@@ -77,7 +78,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
7778
}
7879
}
7980

80-
organization,err:=CurrentOrganization(r,inv,client)
81+
organization,err:=orgContext.Selected(inv,client)
8182
iferr!=nil {
8283
returnxerrors.Errorf("get current organization: %w",err)
8384
}
@@ -324,6 +325,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
324325
},
325326
cliui.SkipPromptOption(),
326327
}
328+
orgContext.AttachOptions(cmd)
327329

328330
returncmd
329331
}

‎cli/templatelist.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func (r*RootCmd)templateList()*serpent.Command {
14+
orgContext:=NewOrganizationContext()
1415
formatter:=cliui.NewOutputFormatter(
1516
cliui.TableFormat([]templateTableRow{}, []string{"name","last updated","used by"}),
1617
cliui.JSONFormat(),
@@ -25,7 +26,7 @@ func (r *RootCmd) templateList() *serpent.Command {
2526
r.InitClient(client),
2627
),
2728
Handler:func(inv*serpent.Invocation)error {
28-
organization,err:=CurrentOrganization(r,inv,client)
29+
organization,err:=orgContext.Selected(inv,client)
2930
iferr!=nil {
3031
returnerr
3132
}
@@ -52,5 +53,6 @@ func (r *RootCmd) templateList() *serpent.Command {
5253
}
5354

5455
formatter.AttachOptions(&cmd.Options)
56+
orgContext.AttachOptions(cmd)
5557
returncmd
5658
}

‎cli/templatepull.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func (r *RootCmd) templatePull() *serpent.Command {
2020
tarModebool
2121
zipModebool
2222
versionNamestring
23+
orgContext=NewOrganizationContext()
2324
)
2425

2526
client:=new(codersdk.Client)
@@ -45,7 +46,7 @@ func (r *RootCmd) templatePull() *serpent.Command {
4546
returnxerrors.Errorf("either tar or zip can be selected")
4647
}
4748

48-
organization,err:=CurrentOrganization(r,inv,client)
49+
organization,err:=orgContext.Selected(inv,client)
4950
iferr!=nil {
5051
returnxerrors.Errorf("get current organization: %w",err)
5152
}
@@ -187,6 +188,7 @@ func (r *RootCmd) templatePull() *serpent.Command {
187188
},
188189
cliui.SkipPromptOption(),
189190
}
191+
orgContext.AttachOptions(cmd)
190192

191193
returncmd
192194
}

‎cli/templatepush.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func (r *RootCmd) templatePush() *serpent.Command {
3434
provisionerTags []string
3535
uploadFlagstemplateUploadFlags
3636
activatebool
37+
orgContext=NewOrganizationContext()
3738
)
3839
client:=new(codersdk.Client)
3940
cmd:=&serpent.Command{
@@ -46,7 +47,7 @@ func (r *RootCmd) templatePush() *serpent.Command {
4647
Handler:func(inv*serpent.Invocation)error {
4748
uploadFlags.setWorkdir(workdir)
4849

49-
organization,err:=CurrentOrganization(r,inv,client)
50+
organization,err:=orgContext.Selected(inv,client)
5051
iferr!=nil {
5152
returnerr
5253
}
@@ -226,6 +227,7 @@ func (r *RootCmd) templatePush() *serpent.Command {
226227
cliui.SkipPromptOption(),
227228
}
228229
cmd.Options=append(cmd.Options,uploadFlags.options()...)
230+
orgContext.AttachOptions(cmd)
229231
returncmd
230232
}
231233

‎cli/templateversionarchive.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
3131
pastVerb="unarchived"
3232
}
3333

34+
orgContext:=NewOrganizationContext()
3435
client:=new(codersdk.Client)
3536
cmd:=&serpent.Command{
3637
Use:presentVerb+" <template-name> [template-version-names...] ",
@@ -47,7 +48,7 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
4748
versions []codersdk.TemplateVersion
4849
)
4950

50-
organization,err:=CurrentOrganization(r,inv,client)
51+
organization,err:=orgContext.Selected(inv,client)
5152
iferr!=nil {
5253
returnerr
5354
}
@@ -92,13 +93,15 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
9293
returnnil
9394
},
9495
}
96+
orgContext.AttachOptions(cmd)
9597

9698
returncmd
9799
}
98100

99101
func (r*RootCmd)archiveTemplateVersions()*serpent.Command {
100102
varall serpent.Bool
101103
client:=new(codersdk.Client)
104+
orgContext:=NewOrganizationContext()
102105
cmd:=&serpent.Command{
103106
Use:"archive [template-name...] ",
104107
Short:"Archive unused or failed template versions from a given template(s)",
@@ -121,7 +124,7 @@ func (r *RootCmd) archiveTemplateVersions() *serpent.Command {
121124
templates= []codersdk.Template{}
122125
)
123126

124-
organization,err:=CurrentOrganization(r,inv,client)
127+
organization,err:=orgContext.Selected(inv,client)
125128
iferr!=nil {
126129
returnerr
127130
}
@@ -179,6 +182,7 @@ func (r *RootCmd) archiveTemplateVersions() *serpent.Command {
179182
returnnil
180183
},
181184
}
185+
orgContext.AttachOptions(cmd)
182186

183187
returncmd
184188
}

‎cli/templateversions.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func (r *RootCmd) templateVersionsList() *serpent.Command {
5151
cliui.JSONFormat(),
5252
)
5353
client:=new(codersdk.Client)
54+
orgContext:=NewOrganizationContext()
5455

5556
varincludeArchived serpent.Bool
5657

@@ -93,7 +94,7 @@ func (r *RootCmd) templateVersionsList() *serpent.Command {
9394
},
9495
},
9596
Handler:func(inv*serpent.Invocation)error {
96-
organization,err:=CurrentOrganization(r,inv,client)
97+
organization,err:=orgContext.Selected(inv,client)
9798
iferr!=nil {
9899
returnxerrors.Errorf("get current organization: %w",err)
99100
}
@@ -122,6 +123,7 @@ func (r *RootCmd) templateVersionsList() *serpent.Command {
122123
},
123124
}
124125

126+
orgContext.AttachOptions(cmd)
125127
formatter.AttachOptions(&cmd.Options)
126128
returncmd
127129
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp