mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor(output): share the JSON, created-resource and batch tails
Mutations end with a.jsonResult or a.created instead of hand-rolled --json branches, the two identical jsonResult/writeMutationJSON helpers become one, and writeBatchJSON checks --json itself so batch commands share one tail. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
32 files changed
+87
-217
No files matched your search
@@ -66,7 +66,7 @@ $ tea milestone issue %[1]s v1.0 12 13 '#14'`, verb), Annotations: map[string]st
|
||||
item, err = service.Edit(cmd.Context(), n, services.IssueEdit{Milestone: &milestone.ID})
|
||||
}
|
||||
return item, itemError(err, target.Repo)
|
||||
}, func(services.Issue) {})
|
||||
}, nil)
|
||||
if len(results) > 0 {
|
||||
changed := make([]string, len(results))
|
||||
for i, item := range results {
|
||||
@@ -74,10 +74,7 @@ $ tea milestone issue %[1]s v1.0 12 13 '#14'`, verb), Annotations: map[string]st
|
||||
}
|
||||
a.done(cmd, "%s %s %s %s", past, strings.Join(changed, ", "), preposition, milestoneName(target, milestone))
|
||||
}
|
||||
if a.options.json != "" {
|
||||
failures = append(failures, writeBatchJSON(a, cmd, len(numbers), results))
|
||||
}
|
||||
return errors.Join(failures...)
|
||||
return errors.Join(append(failures, writeBatchJSON(a, cmd, len(numbers), results))...)
|
||||
}}
|
||||
command.Flags().BoolVar(&byName, "by-name", false, "Match a numeric milestone argument as a title rather than an ID")
|
||||
milestones, issues := a.completeMilestones(), a.completeIssues("open")
|
||||
|
||||
Reference in new issue
Block a user