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
@@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -47,15 +46,6 @@ func countOf(n int, singular, plural string) string {
|
||||
return strconv.Itoa(n) + " " + plural
|
||||
}
|
||||
|
||||
// webURL is the page of a path on the target's instance, such as an organization's profile.
|
||||
func webURL(t target, path ...string) string {
|
||||
escaped := make([]string, len(path))
|
||||
for i, segment := range path {
|
||||
escaped[i] = url.PathEscape(segment)
|
||||
}
|
||||
return strings.TrimSuffix(t.Host, "/") + "/" + strings.Join(escaped, "/")
|
||||
}
|
||||
|
||||
func (a *application) organizationCommand() *cobra.Command {
|
||||
group := &cobra.Command{Use: "org", Short: "Manage organizations", Long: `Work with Gitea organizations: list the ones you belong to, view, create, edit and delete
|
||||
them, and manage their members.
|
||||
|
||||
Reference in new issue
Block a user