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:
@ -10,6 +10,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/git"
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
"github.com/spf13/cobra"
|
||||
@ -30,10 +31,10 @@ type recipeMetadata struct {
|
||||
}
|
||||
|
||||
var RecipeNewCommand = &cobra.Command{
|
||||
Use: "new <recipe> [flags]",
|
||||
Aliases: []string{"n"},
|
||||
Short: "Create a new recipe",
|
||||
Long: `A community managed recipe template is used.`,
|
||||
Use: i18n.G("new <recipe> [flags]"),
|
||||
Aliases: []string{i18n.G("n")},
|
||||
Short: i18n.G("Create a new recipe"),
|
||||
Long: i18n.G(`A community managed recipe template is used.`),
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
@ -46,10 +47,10 @@ var RecipeNewCommand = &cobra.Command{
|
||||
|
||||
r := recipe.Get(recipeName)
|
||||
if _, err := os.Stat(r.Dir); !os.IsNotExist(err) {
|
||||
log.Fatalf("%s recipe directory already exists?", r.Dir)
|
||||
log.Fatal(i18n.G("%s recipe directory already exists?", r.Dir))
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("%s/example.git", config.REPOS_BASE_URL)
|
||||
url := i18n.G("%s/example.git", config.REPOS_BASE_URL)
|
||||
if err := git.Clone(r.Dir, url); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -58,7 +59,7 @@ var RecipeNewCommand = &cobra.Command{
|
||||
if err := os.RemoveAll(gitRepo); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Debugf("removed .git repo in %s", gitRepo)
|
||||
log.Debug(i18n.G("removed .git repo in %s", gitRepo))
|
||||
|
||||
meta := newRecipeMeta(recipeName)
|
||||
|
||||
@ -82,8 +83,8 @@ var RecipeNewCommand = &cobra.Command{
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Infof("new recipe '%s' created: %s", recipeName, path.Join(r.Dir))
|
||||
log.Info("happy hacking 🎉")
|
||||
log.Info(i18n.G("new recipe '%s' created: %s", recipeName, path.Join(r.Dir)))
|
||||
log.Info(i18n.G("happy hacking 🎉"))
|
||||
},
|
||||
}
|
||||
|
||||
@ -111,17 +112,17 @@ var (
|
||||
func init() {
|
||||
RecipeNewCommand.Flags().StringVarP(
|
||||
&gitName,
|
||||
"git-name",
|
||||
"N",
|
||||
i18n.G("git-name"),
|
||||
i18n.G("N"),
|
||||
"",
|
||||
"Git (user) name to do commits with",
|
||||
i18n.G("Git (user) name to do commits with"),
|
||||
)
|
||||
|
||||
RecipeNewCommand.Flags().StringVarP(
|
||||
&gitEmail,
|
||||
"git-email",
|
||||
"e",
|
||||
i18n.G("git-email"),
|
||||
i18n.G("e"),
|
||||
"",
|
||||
"Git email name to do commits with",
|
||||
i18n.G("Git email name to do commits with"),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user