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:
@ -4,15 +4,16 @@ import (
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
"coopcloud.tech/abra/pkg/lint"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var RecipeLintCommand = &cobra.Command{
|
||||
Use: "lint <recipe> [flags]",
|
||||
Short: "Lint a recipe",
|
||||
Aliases: []string{"l"},
|
||||
Use: i18n.G("lint <recipe> [flags]"),
|
||||
Short: i18n.G("Lint a recipe"),
|
||||
Aliases: []string{i18n.G("l")},
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
@ -28,12 +29,12 @@ var RecipeLintCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
headers := []string{
|
||||
"ref",
|
||||
"rule",
|
||||
"severity",
|
||||
"satisfied",
|
||||
"skipped",
|
||||
"resolve",
|
||||
i18n.G("ref"),
|
||||
i18n.G("rule"),
|
||||
i18n.G("severity"),
|
||||
i18n.G("satisfied"),
|
||||
i18n.G("skipped"),
|
||||
i18n.G("resolve"),
|
||||
}
|
||||
|
||||
table, err := formatter.CreateTable()
|
||||
@ -49,7 +50,7 @@ var RecipeLintCommand = &cobra.Command{
|
||||
for level := range lint.LintRules {
|
||||
for _, rule := range lint.LintRules[level] {
|
||||
if onlyError && rule.Level != "error" {
|
||||
log.Debugf("skipping %s, does not have level \"error\"", rule.Ref)
|
||||
log.Debug(i18n.G("skipping %s, does not have level \"error\"", rule.Ref))
|
||||
continue
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ var RecipeLintCommand = &cobra.Command{
|
||||
warnMessages = append(warnMessages, err.Error())
|
||||
}
|
||||
|
||||
if !ok && rule.Level == "error" {
|
||||
if !ok && rule.Level == i18n.G("error") {
|
||||
hasError = true
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ var RecipeLintCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
if hasError {
|
||||
log.Warnf("critical errors present in %s config", recipe.Name)
|
||||
log.Warn(i18n.G("critical errors present in %s config", recipe.Name))
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -124,17 +125,17 @@ var (
|
||||
func init() {
|
||||
RecipeLintCommand.Flags().BoolVarP(
|
||||
&internal.Chaos,
|
||||
"chaos",
|
||||
"C",
|
||||
i18n.G("chaos"),
|
||||
i18n.G("C"),
|
||||
false,
|
||||
"ignore uncommitted recipes changes",
|
||||
i18n.G("ignore uncommitted recipes changes"),
|
||||
)
|
||||
|
||||
RecipeLintCommand.Flags().BoolVarP(
|
||||
&onlyError,
|
||||
"error",
|
||||
"e",
|
||||
i18n.G("error"),
|
||||
i18n.G("e"),
|
||||
false,
|
||||
"only show errors",
|
||||
i18n.G("only show errors"),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user