WIP: feat: translation support
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
See #483
This commit is contained in:
@ -13,6 +13,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"coopcloud.tech/tagcmp"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -39,20 +40,20 @@ type serverStatus struct {
|
||||
}
|
||||
|
||||
var AppListCommand = &cobra.Command{
|
||||
Use: "list [flags]",
|
||||
Use: gotext.Get("list [flags]"),
|
||||
Aliases: []string{"ls"},
|
||||
Short: "List all managed apps",
|
||||
Long: `Generate a report of all managed apps.
|
||||
Short: gotext.Get("List all managed apps"),
|
||||
Long: gotext.Get(`Generate a report of all managed apps.
|
||||
|
||||
Use "--status/-S" flag to query all servers for the live deployment status.`,
|
||||
Example: ` # list apps of all servers without live status
|
||||
Use "--status/-S" flag to query all servers for the live deployment status.`),
|
||||
Example: gotext.Get(` # list apps of all servers without live status
|
||||
abra app ls
|
||||
|
||||
# list apps of a specific server with live status
|
||||
abra app ls -s 1312.net -S
|
||||
|
||||
# list apps of all servers which match a specific recipe
|
||||
abra app ls -r gitea`,
|
||||
abra app ls -r gitea`),
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
appFiles, err := appPkg.LoadAppFiles(listAppServer)
|
||||
@ -144,12 +145,12 @@ Use "--status/-S" flag to query all servers for the live deployment status.`,
|
||||
var newUpdates []string
|
||||
if version != "unknown" && chaos == "false" {
|
||||
if err := app.Recipe.EnsureExists(); err != nil {
|
||||
log.Fatalf("unable to clone %s: %s", app.Name, err)
|
||||
log.Fatal(gotext.Get("unable to clone %s: %s", app.Name, err))
|
||||
}
|
||||
|
||||
updates, err := app.Recipe.Tags()
|
||||
if err != nil {
|
||||
log.Fatalf("unable to retrieve tags for %s: %s", app.Name, err)
|
||||
log.Fatal(gotext.Get("unable to retrieve tags for %s: %s", app.Name, err))
|
||||
}
|
||||
|
||||
parsedVersion, err := tagcmp.Parse(version)
|
||||
@ -215,11 +216,12 @@ Use "--status/-S" flag to query all servers for the live deployment status.`,
|
||||
headers := []string{"RECIPE", "DOMAIN", "SERVER"}
|
||||
if status {
|
||||
headers = append(headers, []string{
|
||||
"STATUS",
|
||||
"CHAOS",
|
||||
"VERSION",
|
||||
"UPGRADE",
|
||||
"AUTOUPDATE"}...,
|
||||
gotext.Get("STATUS"),
|
||||
gotext.Get("CHAOS"),
|
||||
gotext.Get("VERSION"),
|
||||
gotext.Get("UPGRADE"),
|
||||
gotext.Get("AUTOUPDATE"),
|
||||
}...,
|
||||
)
|
||||
}
|
||||
|
||||
@ -286,7 +288,7 @@ func init() {
|
||||
"status",
|
||||
"S",
|
||||
false,
|
||||
"show app deployment status",
|
||||
gotext.Get("show app deployment status"),
|
||||
)
|
||||
|
||||
AppListCommand.Flags().StringVarP(
|
||||
@ -294,7 +296,7 @@ func init() {
|
||||
"recipe",
|
||||
"r",
|
||||
"",
|
||||
"show apps of a specific recipe",
|
||||
gotext.Get("show apps of a specific recipe"),
|
||||
)
|
||||
|
||||
AppListCommand.RegisterFlagCompletionFunc(
|
||||
@ -309,7 +311,7 @@ func init() {
|
||||
"machine",
|
||||
"m",
|
||||
false,
|
||||
"print machine-readable output",
|
||||
gotext.Get("print machine-readable output"),
|
||||
)
|
||||
|
||||
AppListCommand.Flags().StringVarP(
|
||||
@ -317,7 +319,7 @@ func init() {
|
||||
"server",
|
||||
"s",
|
||||
"",
|
||||
"show apps of a specific server",
|
||||
gotext.Get("show apps of a specific server"),
|
||||
)
|
||||
|
||||
AppListCommand.RegisterFlagCompletionFunc(
|
||||
|
Reference in New Issue
Block a user