@@ -127,6 +127,12 @@ func edit(cmd *cobra.Command, args []string) {
127
127
}
128
128
fixVersions = append (fixVersions , params .fixVersions ... )
129
129
130
+ affectsVersions := make ([]string , 0 , len (issue .Fields .AffectsVersions )+ len (params .affectsVersions ))
131
+ for _ , fv := range issue .Fields .AffectsVersions {
132
+ affectsVersions = append (affectsVersions , fv .Name )
133
+ }
134
+ affectsVersions = append (affectsVersions , params .affectsVersions ... )
135
+
130
136
err = func () error {
131
137
s := cmdutil .Info ("Updating an issue..." )
132
138
defer s .Stop ()
@@ -142,14 +148,15 @@ func edit(cmd *cobra.Command, args []string) {
142
148
}
143
149
144
150
edr := jira.EditRequest {
145
- ParentIssueKey : parent ,
146
- Summary : params .summary ,
147
- Body : body ,
148
- Priority : params .priority ,
149
- Labels : labels ,
150
- Components : components ,
151
- FixVersions : fixVersions ,
152
- CustomFields : params .customFields ,
151
+ ParentIssueKey : parent ,
152
+ Summary : params .summary ,
153
+ Body : body ,
154
+ Priority : params .priority ,
155
+ Labels : labels ,
156
+ Components : components ,
157
+ FixVersions : fixVersions ,
158
+ AffectsVersions : affectsVersions ,
159
+ CustomFields : params .customFields ,
153
160
}
154
161
if configuredCustomFields , err := cmdcommon .GetConfiguredCustomFields (); err == nil {
155
162
cmdcommon .ValidateCustomFields (edr .CustomFields , configuredCustomFields )
@@ -187,10 +194,11 @@ func getAnswers(params *editParams, issue *jira.Issue) {
187
194
if len (ans .Metadata ) > 0 {
188
195
qs := getMetadataQuestions (ans .Metadata , issue )
189
196
ans := struct {
190
- Priority string
191
- Labels string
192
- Components string
193
- FixVersions string
197
+ Priority string
198
+ Labels string
199
+ Components string
200
+ FixVersions string
201
+ AffectsVersions string
194
202
}{}
195
203
err := survey .Ask (qs , & ans )
196
204
cmdutil .ExitIfError (err )
@@ -207,6 +215,9 @@ func getAnswers(params *editParams, issue *jira.Issue) {
207
215
if len (ans .FixVersions ) > 0 {
208
216
params .fixVersions = strings .Split (ans .FixVersions , "," )
209
217
}
218
+ if len (ans .AffectsVersions ) > 0 {
219
+ params .affectsVersions = strings .Split (ans .AffectsVersions , "," )
220
+ }
210
221
}
211
222
}
212
223
}
@@ -289,17 +300,18 @@ func (ec *editCmd) askQuestions(issue *jira.Issue, originalBody string) error {
289
300
}
290
301
291
302
type editParams struct {
292
- issueKey string
293
- summary string
294
- body string
295
- priority string
296
- assignee string
297
- labels []string
298
- components []string
299
- fixVersions []string
300
- customFields map [string ]string
301
- noInput bool
302
- debug bool
303
+ issueKey string
304
+ summary string
305
+ body string
306
+ priority string
307
+ assignee string
308
+ labels []string
309
+ components []string
310
+ fixVersions []string
311
+ affectsVersions []string
312
+ customFields map [string ]string
313
+ noInput bool
314
+ debug bool
303
315
}
304
316
305
317
func parseArgsAndFlags (flags query.FlagParser , args []string , project string ) * editParams {
@@ -324,6 +336,9 @@ func parseArgsAndFlags(flags query.FlagParser, args []string, project string) *e
324
336
fixVersions , err := flags .GetStringArray ("fix-version" )
325
337
cmdutil .ExitIfError (err )
326
338
339
+ affectsVersions , err := flags .GetStringArray ("affects-version" )
340
+ cmdutil .ExitIfError (err )
341
+
327
342
custom , err := flags .GetStringToString ("custom" )
328
343
cmdutil .ExitIfError (err )
329
344
@@ -334,17 +349,18 @@ func parseArgsAndFlags(flags query.FlagParser, args []string, project string) *e
334
349
cmdutil .ExitIfError (err )
335
350
336
351
return & editParams {
337
- issueKey : cmdutil .GetJiraIssueKey (project , args [0 ]),
338
- summary : summary ,
339
- body : body ,
340
- priority : priority ,
341
- assignee : assignee ,
342
- labels : labels ,
343
- components : components ,
344
- fixVersions : fixVersions ,
345
- customFields : custom ,
346
- noInput : noInput ,
347
- debug : debug ,
352
+ issueKey : cmdutil .GetJiraIssueKey (project , args [0 ]),
353
+ summary : summary ,
354
+ body : body ,
355
+ priority : priority ,
356
+ assignee : assignee ,
357
+ labels : labels ,
358
+ components : components ,
359
+ fixVersions : fixVersions ,
360
+ affectsVersions : affectsVersions ,
361
+ customFields : custom ,
362
+ noInput : noInput ,
363
+ debug : debug ,
348
364
}
349
365
}
350
366
@@ -356,6 +372,11 @@ func getMetadataQuestions(meta []string, issue *jira.Issue) []*survey.Question {
356
372
fixVersions = append (fixVersions , fv .Name )
357
373
}
358
374
375
+ affectsVersions := make ([]string , 0 , len (issue .Fields .AffectsVersions ))
376
+ for _ , fv := range issue .Fields .AffectsVersions {
377
+ affectsVersions = append (affectsVersions , fv .Name )
378
+ }
379
+
359
380
for _ , m := range meta {
360
381
switch m {
361
382
case "Priority" :
@@ -389,6 +410,15 @@ func getMetadataQuestions(meta []string, issue *jira.Issue) []*survey.Question {
389
410
Default : strings .Join (fixVersions , "," ),
390
411
},
391
412
})
413
+ case "AffectsVersions" :
414
+ qs = append (qs , & survey.Question {
415
+ Name : "affectsversions" ,
416
+ Prompt : & survey.Input {
417
+ Message : "Affects Versions" ,
418
+ Help : "Comma separated list of affectsVersions. For eg: v1.0-beta,v2.0" ,
419
+ Default : strings .Join (affectsVersions , "," ),
420
+ },
421
+ })
392
422
}
393
423
}
394
424
@@ -407,6 +437,7 @@ func setFlags(cmd *cobra.Command) {
407
437
cmd .Flags ().StringArrayP ("label" , "l" , []string {}, "Append labels" )
408
438
cmd .Flags ().StringArrayP ("component" , "C" , []string {}, "Replace components" )
409
439
cmd .Flags ().StringArray ("fix-version" , []string {}, "Add/Append release info (fixVersions)" )
440
+ cmd .Flags ().StringArray ("affects-version" , []string {}, "Add/Append release info (affectsVersions)" )
410
441
cmd .Flags ().StringToString ("custom" , custom , "Edit custom fields" )
411
442
cmd .Flags ().Bool ("web" , false , "Open in web browser after successful update" )
412
443
cmd .Flags ().Bool ("no-input" , false , "Disable prompt for non-required fields" )
0 commit comments