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
@@ -103,9 +103,6 @@ func (a *application) pullCleanCommand() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, result)
|
||||
}
|
||||
a.done(cmd, "Deleted local branch %s", result.LocalBranch)
|
||||
switch {
|
||||
case result.RemoteDeleted:
|
||||
@@ -115,7 +112,7 @@ func (a *application) pullCleanCommand() *cobra.Command {
|
||||
case !pull.HeadCanPush:
|
||||
a.warn(cmd, "Kept remote branch %s: you cannot push to %s", pull.Head, pull.HeadRepo)
|
||||
}
|
||||
return nil
|
||||
return a.jsonResult(cmd, result)
|
||||
}}
|
||||
cmd.Flags().BoolVar(&ignoreSHA, "ignore-sha", false, "Find the local branch by name instead of commit hash")
|
||||
cmd.ValidArgsFunction = a.completePulls("closed")
|
||||
|
||||
Reference in new issue
Block a user