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
@@ -143,15 +143,12 @@ argument select it, and the branch tracks the head branch, so that git push upda
|
||||
undoRemote()
|
||||
return err
|
||||
}
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, result)
|
||||
}
|
||||
if result.Detached {
|
||||
a.done(cmd, "Checked out #%d at %s (detached HEAD)", n, shortSHA(result.Commit))
|
||||
} else {
|
||||
a.done(cmd, "Checked out #%d into %s", n, result.Branch)
|
||||
}
|
||||
return nil
|
||||
return a.jsonResult(cmd, result)
|
||||
}}
|
||||
cmd.Flags().BoolVar(&update, "update", false, "Fast-forward an existing branch to the PR head; reject divergence")
|
||||
cmd.Flags().BoolVar(&detached, "detach", false, "Check out the PR commit without creating or changing a branch")
|
||||
|
||||
Reference in new issue
Block a user