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
@@ -50,11 +50,8 @@ $ tea milestone %[1]s v1.0 v1.1`, verb), Annotations: map[string]string{"tea.arg
|
||||
a.done(cmd, "%s %s", past, milestoneName(t, item))
|
||||
}
|
||||
return item, err
|
||||
}, func(services.Milestone) {})
|
||||
if a.options.json != "" {
|
||||
failures = append(failures, writeBatchJSON(a, cmd, len(selected), results))
|
||||
}
|
||||
return errors.Join(failures...)
|
||||
}, nil)
|
||||
return errors.Join(append(failures, writeBatchJSON(a, cmd, len(selected), results))...)
|
||||
}}
|
||||
cmd.Flags().BoolVar(&byName, "by-name", false, "Match numeric arguments as milestone titles rather than IDs")
|
||||
cmd.ValidArgsFunction = a.completeMilestoneArgs(true)
|
||||
|
||||
Reference in new issue
Block a user