mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor: load settings once per run and reuse shared helpers
The application caches the settings snapshot and reloads it only after an update through the store, so output and prompt helpers no longer read and parse config.yml and hosts.yml several times per command. canPrompt and chooser replace the inline prompt-policy checks. Checks are tallied by one services.Tally, terminal.Plural replaces the two app copies, refKind.article/noun replace the comment group's own words, list commands use servicePage, and web URLs are built by repositoryURL and webURL in browser.go. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
42 files changed
+157
-204
No files matched your search
@@ -109,7 +109,7 @@ each pull request, which tea only makes when --json names them.`, Args: argsExac
|
||||
}
|
||||
},
|
||||
Empty: empty, Context: what,
|
||||
}, listPage{Number: page, More: window.More, Total: window.Total, Counted: window.Counted})
|
||||
}, servicePage(window, page))
|
||||
}}
|
||||
enumFlag(cmd, &state, "state", "s", "open", "Filter by state", "open", "closed", "merged", "all")
|
||||
pageFlags(cmd, &limit, &page)
|
||||
@@ -163,11 +163,6 @@ func (a *application) jsonSelects(fields ...string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// repositoryURL returns the web URL of the target's repository.
|
||||
func repositoryURL(t target) string {
|
||||
return strings.TrimSuffix(t.Host, "/") + "/" + t.Repo
|
||||
}
|
||||
|
||||
// milestoneFilter resolves a milestone given as an ID or a title (D10): a number is an ID first,
|
||||
// then a title.
|
||||
func milestoneFilter(ctx context.Context, t target, raw string) (int64, error) {
|
||||
|
||||
Reference in new issue
Block a user