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
@@ -243,7 +243,7 @@ $ tea workflow run nightly --follow`,
|
||||
if !follow {
|
||||
a.nextStep(cmd, "Watch it: tea run watch %d%s", result.ID, a.suggestedRepo(t))
|
||||
}
|
||||
if err := a.printURL(cmd, result.URL); err != nil || !follow {
|
||||
if err := a.created(cmd, result, result.URL); err != nil || !follow {
|
||||
return err
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(cmd.Context(), timeout)
|
||||
@@ -474,10 +474,7 @@ $ tea workflow %s Nightly`, verb, verb),
|
||||
}
|
||||
a.done(cmd, "%s %s", done, workflow.Label())
|
||||
}
|
||||
if a.options.json != "" {
|
||||
return a.writeJSON(cmd, workflow)
|
||||
}
|
||||
return nil
|
||||
return a.jsonResult(cmd, workflow)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user