@@ -32,6 +32,17 @@ func (pf *templateUploadFlags) option() clibase.Option {
32
32
}
33
33
}
34
34
35
+ func (pf * templateUploadFlags ) setWorkdir (wd string ) {
36
+ if wd == "" {
37
+ return
38
+ }
39
+ if pf .directory == "" || pf .directory == "." {
40
+ pf .directory = wd
41
+ } else if ! filepath .IsAbs (pf .directory ) {
42
+ pf .directory = filepath .Join (wd , pf .directory )
43
+ }
44
+ }
45
+
35
46
func (pf * templateUploadFlags ) stdin () bool {
36
47
return pf .directory == "-"
37
48
}
@@ -98,6 +109,7 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
98
109
var (
99
110
versionName string
100
111
provisioner string
112
+ workdir string
101
113
parameterFile string
102
114
variablesFile string
103
115
variables []string
@@ -114,6 +126,8 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
114
126
r .InitClient (client ),
115
127
),
116
128
Handler : func (inv * clibase.Invocation ) error {
129
+ uploadFlags .setWorkdir (workdir )
130
+
117
131
organization , err := CurrentOrganization (inv , client )
118
132
if err != nil {
119
133
return err
@@ -174,11 +188,18 @@ func (r *RootCmd) templatePush() *clibase.Cmd {
174
188
175
189
cmd .Options = clibase.OptionSet {
176
190
{
177
- Flag : "test.provisioner" ,
178
- FlagShorthand : "p" ,
179
- Description : "Customize the provisioner backend." ,
180
- Default : "terraform" ,
181
- Value : clibase .StringOf (& provisioner ),
191
+ Flag : "test.provisioner" ,
192
+ Description : "Customize the provisioner backend." ,
193
+ Default : "terraform" ,
194
+ Value : clibase .StringOf (& provisioner ),
195
+ // This is for testing!
196
+ Hidden : true ,
197
+ },
198
+ {
199
+ Flag : "test.workdir" ,
200
+ Description : "Customize the working directory." ,
201
+ Default : "" ,
202
+ Value : clibase .StringOf (& workdir ),
182
203
// This is for testing!
183
204
Hidden : true ,
184
205
},
0 commit comments