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:
@ -7,17 +7,18 @@ import (
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var AppRestoreCommand = &cobra.Command{
|
||||
Use: "restore <domain> [flags]",
|
||||
Aliases: []string{"rs"},
|
||||
Short: "Restore a snapshot",
|
||||
Long: `Snapshots are restored while apps are deployed.
|
||||
Use: i18n.G("restore <domain> [flags]"),
|
||||
Aliases: []string{i18n.G("rs")},
|
||||
Short: i18n.G("Restore a snapshot"),
|
||||
Long: i18n.G(`Snapshots are restored while apps are deployed.
|
||||
|
||||
Some restore scenarios may require service / app restarts.`,
|
||||
Some restore scenarios may require service / app restarts.`),
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
@ -48,34 +49,34 @@ Some restore scenarios may require service / app restarts.`,
|
||||
}
|
||||
|
||||
if snapshot != "" {
|
||||
log.Debugf("including SNAPSHOT=%s in backupbot exec invocation", snapshot)
|
||||
log.Debug(i18n.G("including SNAPSHOT=%s in backupbot exec invocation", snapshot))
|
||||
execEnv = append(execEnv, fmt.Sprintf("SNAPSHOT=%s", snapshot))
|
||||
}
|
||||
|
||||
if targetPath != "" {
|
||||
log.Debugf("including TARGET=%s in backupbot exec invocation", targetPath)
|
||||
log.Debug(i18n.G("including TARGET=%s in backupbot exec invocation", targetPath))
|
||||
execEnv = append(execEnv, fmt.Sprintf("TARGET=%s", targetPath))
|
||||
}
|
||||
|
||||
if internal.NoInput {
|
||||
log.Debugf("including NONINTERACTIVE=%v in backupbot exec invocation", internal.NoInput)
|
||||
log.Debug(i18n.G("including NONINTERACTIVE=%v in backupbot exec invocation", internal.NoInput))
|
||||
execEnv = append(execEnv, fmt.Sprintf("NONINTERACTIVE=%v", internal.NoInput))
|
||||
}
|
||||
|
||||
if len(volumes) > 0 {
|
||||
allVolumes := strings.Join(volumes, ",")
|
||||
log.Debugf("including VOLUMES=%s in backupbot exec invocation", allVolumes)
|
||||
log.Debug(i18n.G("including VOLUMES=%s in backupbot exec invocation", allVolumes))
|
||||
execEnv = append(execEnv, fmt.Sprintf("VOLUMES=%s", allVolumes))
|
||||
}
|
||||
|
||||
if len(services) > 0 {
|
||||
allServices := strings.Join(services, ",")
|
||||
log.Debugf("including CONTAINER=%s in backupbot exec invocation", allServices)
|
||||
log.Debug(i18n.G("including CONTAINER=%s in backupbot exec invocation", allServices))
|
||||
execEnv = append(execEnv, fmt.Sprintf("CONTAINER=%s", allServices))
|
||||
}
|
||||
|
||||
if hooks {
|
||||
log.Debugf("including NO_COMMANDS=%v in backupbot exec invocation", false)
|
||||
log.Debug(i18n.G("including NO_COMMANDS=%v in backupbot exec invocation", false))
|
||||
execEnv = append(execEnv, fmt.Sprintf("NO_COMMANDS=%v", false))
|
||||
}
|
||||
|
||||
@ -95,41 +96,41 @@ var (
|
||||
func init() {
|
||||
AppRestoreCommand.Flags().StringVarP(
|
||||
&targetPath,
|
||||
"target",
|
||||
"t",
|
||||
i18n.G("target"),
|
||||
i18n.G("t"),
|
||||
"/",
|
||||
"target path",
|
||||
i18n.G("target path"),
|
||||
)
|
||||
|
||||
AppRestoreCommand.Flags().StringArrayVarP(
|
||||
&services,
|
||||
"services",
|
||||
"s",
|
||||
i18n.G("services"),
|
||||
i18n.G("s"),
|
||||
[]string{},
|
||||
"restore specific services",
|
||||
i18n.G("restore specific services"),
|
||||
)
|
||||
|
||||
AppRestoreCommand.Flags().StringArrayVarP(
|
||||
&volumes,
|
||||
"volumes",
|
||||
"v",
|
||||
i18n.G("volumes"),
|
||||
i18n.G("v"),
|
||||
[]string{},
|
||||
"restore specific volumes",
|
||||
i18n.G("restore specific volumes"),
|
||||
)
|
||||
|
||||
AppRestoreCommand.Flags().BoolVarP(
|
||||
&hooks,
|
||||
"hooks",
|
||||
"H",
|
||||
i18n.G("hooks"),
|
||||
i18n.G("H"),
|
||||
false,
|
||||
"enable pre/post-hook command execution",
|
||||
i18n.G("enable pre/post-hook command execution"),
|
||||
)
|
||||
|
||||
AppRestoreCommand.Flags().BoolVarP(
|
||||
&internal.Chaos,
|
||||
"chaos",
|
||||
"C",
|
||||
i18n.G("chaos"),
|
||||
i18n.G("C"),
|
||||
false,
|
||||
"ignore uncommitted recipes changes",
|
||||
i18n.G("ignore uncommitted recipes changes"),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user