mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11: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
@@ -371,8 +371,5 @@ func (a *application) createPullInteractively(cmd *cobra.Command, snapshot setti
|
||||
// reportCreatedPull reports a new pull request and prints its URL, or the pull request as JSON.
|
||||
func (a *application) reportCreatedPull(cmd *cobra.Command, t target, item services.Pull) error {
|
||||
a.done(cmd, "Created pull request %s", refLabel(t.Repo, item.Number, item.Title))
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, item)
|
||||
}
|
||||
return a.printURL(cmd, item.URL)
|
||||
return a.created(cmd, item, item.URL)
|
||||
}
|
||||
Reference in new issue
Block a user