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
@@ -617,11 +617,8 @@ $ tea run cancel 34 --force`,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, run)
|
||||
}
|
||||
a.done(cmd, "Requested cancellation of run %d", id)
|
||||
return nil
|
||||
return a.jsonResult(cmd, run)
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolVar(&force, "force", false, "Cancel without waiting for the runner to acknowledge")
|
||||
@@ -678,11 +675,8 @@ $ tea run rerun 34 --job build`,
|
||||
if run, err = service.Run(cmd.Context(), id); err != nil {
|
||||
return err
|
||||
}
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, run)
|
||||
}
|
||||
a.done(cmd, "Requested rerun of run %d (attempt %d); watch it with: tea run watch %d%s", id, run.Attempt, id, a.suggestedRepo(t))
|
||||
return nil
|
||||
return a.jsonResult(cmd, run)
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolVar(&failed, "failed", false, "Rerun only the failed jobs")
|
||||
|
||||
Reference in new issue
Block a user