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
@@ -125,10 +125,7 @@ pull request, or mark it as a draft or ready for review.`, Annotations: pullArgu
|
||||
return err
|
||||
}
|
||||
a.done(cmd, "Edited pull request %s", refLabel(t.Repo, n, item.Title))
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, item)
|
||||
}
|
||||
return nil
|
||||
return a.jsonResult(cmd, item)
|
||||
}}
|
||||
cmd.Flags().StringVarP(&title, "title", "t", "", "Pull request title")
|
||||
cmd.Flags().StringVar(&deadline, "deadline", "", "Due date: YYYY-MM-DD, RFC3339, or Unix timestamp; empty clears")
|
||||
@@ -206,10 +203,7 @@ removes or adds that marker.`, Annotations: pullArgumentsAnnotation(nil), Args:
|
||||
a.done(cmd, "Marked pull request %s as ready for review", refLabel(t.Repo, n, item.Title))
|
||||
}
|
||||
}
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, item)
|
||||
}
|
||||
return nil
|
||||
return a.jsonResult(cmd, item)
|
||||
}}
|
||||
cmd.Flags().BoolVar(&undo, "undo", false, "Turn the pull request back into a draft")
|
||||
cmd.ValidArgsFunction = a.completePulls("open")
|
||||
|
||||
Reference in new issue
Block a user