feat: translation support
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
See #483
This commit is contained in:
@ -8,15 +8,16 @@ import (
|
||||
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var RecipeListCommand = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List recipes",
|
||||
Aliases: []string{"ls"},
|
||||
Use: i18n.G("list"),
|
||||
Short: i18n.G("List recipes"),
|
||||
Aliases: []string{i18n.G("ls")},
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
catl, err := recipe.ReadRecipeCatalogue(internal.Offline)
|
||||
@ -33,14 +34,14 @@ var RecipeListCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
headers := []string{
|
||||
"name",
|
||||
"category",
|
||||
"status",
|
||||
"healthcheck",
|
||||
"backups",
|
||||
"email",
|
||||
"tests",
|
||||
"SSO",
|
||||
i18n.G("name"),
|
||||
i18n.G("category"),
|
||||
i18n.G("status"),
|
||||
i18n.G("healthcheck"),
|
||||
i18n.G("backups"),
|
||||
i18n.G("email"),
|
||||
i18n.G("tests"),
|
||||
i18n.G("SSO"),
|
||||
}
|
||||
|
||||
table.Headers(headers...)
|
||||
@ -73,7 +74,7 @@ var RecipeListCommand = &cobra.Command{
|
||||
if internal.MachineReadable {
|
||||
out, err := formatter.ToJSON(headers, rows)
|
||||
if err != nil {
|
||||
log.Fatal("unable to render to JSON: %s", err)
|
||||
log.Fatal(i18n.G("unable to render to JSON: %s", err))
|
||||
}
|
||||
fmt.Println(out)
|
||||
return
|
||||
@ -93,17 +94,17 @@ var (
|
||||
func init() {
|
||||
RecipeListCommand.Flags().BoolVarP(
|
||||
&internal.MachineReadable,
|
||||
"machine",
|
||||
"m",
|
||||
i18n.G("machine"),
|
||||
i18n.G("m"),
|
||||
false,
|
||||
"print machine-readable output",
|
||||
i18n.G("print machine-readable output"),
|
||||
)
|
||||
|
||||
RecipeListCommand.Flags().StringVarP(
|
||||
&pattern,
|
||||
"pattern",
|
||||
"p",
|
||||
i18n.G("pattern"),
|
||||
i18n.G("p"),
|
||||
"",
|
||||
"filter by recipe",
|
||||
i18n.G("filter by recipe"),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user