@@ -31,6 +31,7 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
31
31
pastVerb = "unarchived"
32
32
}
33
33
34
+ orgContext := NewOrganizationContext ()
34
35
client := new (codersdk.Client )
35
36
cmd := & serpent.Command {
36
37
Use :presentVerb + " <template-name> [template-version-names...] " ,
@@ -47,7 +48,7 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
47
48
versions []codersdk.TemplateVersion
48
49
)
49
50
50
- organization ,err := CurrentOrganization ( r , inv ,client )
51
+ organization ,err := orgContext . Selected ( inv ,client )
51
52
if err != nil {
52
53
return err
53
54
}
@@ -92,13 +93,15 @@ func (r *RootCmd) setArchiveTemplateVersion(archive bool) *serpent.Command {
92
93
return nil
93
94
},
94
95
}
96
+ orgContext .AttachOptions (cmd )
95
97
96
98
return cmd
97
99
}
98
100
99
101
func (r * RootCmd )archiveTemplateVersions ()* serpent.Command {
100
102
var all serpent.Bool
101
103
client := new (codersdk.Client )
104
+ orgContext := NewOrganizationContext ()
102
105
cmd := & serpent.Command {
103
106
Use :"archive [template-name...] " ,
104
107
Short :"Archive unused or failed template versions from a given template(s)" ,
@@ -121,7 +124,7 @@ func (r *RootCmd) archiveTemplateVersions() *serpent.Command {
121
124
templates = []codersdk.Template {}
122
125
)
123
126
124
- organization ,err := CurrentOrganization ( r , inv ,client )
127
+ organization ,err := orgContext . Selected ( inv ,client )
125
128
if err != nil {
126
129
return err
127
130
}
@@ -179,6 +182,7 @@ func (r *RootCmd) archiveTemplateVersions() *serpent.Command {
179
182
return nil
180
183
},
181
184
}
185
+ orgContext .AttachOptions (cmd )
182
186
183
187
return cmd
184
188
}