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:
@ -6,14 +6,15 @@ 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 AppBackupListCommand = &cobra.Command{
|
||||
Use: "list <domain> [flags]",
|
||||
Aliases: []string{"ls"},
|
||||
Short: "List the contents of a snapshot",
|
||||
Use: i18n.G("list <domain> [flags]"),
|
||||
Aliases: []string{i18n.G("ls")},
|
||||
Short: i18n.G("List the contents of a snapshot"),
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
@ -40,17 +41,17 @@ var AppBackupListCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
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 showAllPaths {
|
||||
log.Debugf("including SHOW_ALL=%v in backupbot exec invocation", showAllPaths)
|
||||
log.Debug(i18n.G("including SHOW_ALL=%v in backupbot exec invocation", showAllPaths))
|
||||
execEnv = append(execEnv, fmt.Sprintf("SHOW_ALL=%v", showAllPaths))
|
||||
}
|
||||
|
||||
if timestamps {
|
||||
log.Debugf("including TIMESTAMPS=%v in backupbot exec invocation", timestamps)
|
||||
log.Debug(i18n.G("including TIMESTAMPS=%v in backupbot exec invocation", timestamps))
|
||||
execEnv = append(execEnv, fmt.Sprintf("TIMESTAMPS=%v", timestamps))
|
||||
}
|
||||
|
||||
@ -61,13 +62,13 @@ var AppBackupListCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
var AppBackupDownloadCommand = &cobra.Command{
|
||||
Use: "download <domain> [flags]",
|
||||
Aliases: []string{"d"},
|
||||
Short: "Download a snapshot",
|
||||
Long: `Downloads a backup.tar.gz to the current working directory.
|
||||
Use: i18n.G("download <domain> [flags]"),
|
||||
Aliases: []string{i18n.G("d")},
|
||||
Short: i18n.G("Download a snapshot"),
|
||||
Long: i18n.G(`Downloads a backup.tar.gz to the current working directory.
|
||||
|
||||
"--volumes/-v" includes data contained in volumes alongide paths specified in
|
||||
"backupbot.backup.path" labels.`,
|
||||
"backupbot.backup.path" labels.`),
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
@ -98,22 +99,22 @@ var AppBackupDownloadCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
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 includePath != "" {
|
||||
log.Debugf("including INCLUDE_PATH=%s in backupbot exec invocation", includePath)
|
||||
log.Debug(i18n.G("including INCLUDE_PATH=%s in backupbot exec invocation", includePath))
|
||||
execEnv = append(execEnv, fmt.Sprintf("INCLUDE_PATH=%s", includePath))
|
||||
}
|
||||
|
||||
if includeSecrets {
|
||||
log.Debugf("including SECRETS=%v in backupbot exec invocation", includeSecrets)
|
||||
log.Debug(i18n.G("including SECRETS=%v in backupbot exec invocation", includeSecrets))
|
||||
execEnv = append(execEnv, fmt.Sprintf("SECRETS=%v", includeSecrets))
|
||||
}
|
||||
|
||||
if includeVolumes {
|
||||
log.Debugf("including VOLUMES=%v in backupbot exec invocation", includeVolumes)
|
||||
log.Debug(i18n.G("including VOLUMES=%v in backupbot exec invocation", includeVolumes))
|
||||
execEnv = append(execEnv, fmt.Sprintf("VOLUMES=%v", includeVolumes))
|
||||
}
|
||||
|
||||
@ -130,9 +131,9 @@ var AppBackupDownloadCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
var AppBackupCreateCommand = &cobra.Command{
|
||||
Use: "create <domain> [flags]",
|
||||
Aliases: []string{"c"},
|
||||
Short: "Create a new snapshot",
|
||||
Use: i18n.G("create <domain> [flags]"),
|
||||
Aliases: []string{i18n.G("c")},
|
||||
Short: i18n.G("Create a new snapshot"),
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
@ -163,7 +164,7 @@ var AppBackupCreateCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
if retries != "" {
|
||||
log.Debugf("including RETRIES=%s in backupbot exec invocation", retries)
|
||||
log.Debug(i18n.G("including RETRIES=%s in backupbot exec invocation", retries))
|
||||
execEnv = append(execEnv, fmt.Sprintf("RETRIES=%s", retries))
|
||||
}
|
||||
|
||||
@ -174,9 +175,9 @@ var AppBackupCreateCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
var AppBackupSnapshotsCommand = &cobra.Command{
|
||||
Use: "snapshots <domain> [flags]",
|
||||
Aliases: []string{"s"},
|
||||
Short: "List all snapshots",
|
||||
Use: i18n.G("snapshots <domain> [flags]"),
|
||||
Aliases: []string{i18n.G("s")},
|
||||
Short: i18n.G("List all snapshots"),
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
@ -209,9 +210,9 @@ var AppBackupSnapshotsCommand = &cobra.Command{
|
||||
}
|
||||
|
||||
var AppBackupCommand = &cobra.Command{
|
||||
Use: "backup [cmd] [args] [flags]",
|
||||
Aliases: []string{"b"},
|
||||
Short: "Manage app backups",
|
||||
Use: i18n.G("backup [cmd] [args] [flags]"),
|
||||
Aliases: []string{i18n.G("b")},
|
||||
Short: i18n.G("Manage app backups"),
|
||||
}
|
||||
|
||||
var (
|
||||
@ -227,81 +228,81 @@ var (
|
||||
func init() {
|
||||
AppBackupListCommand.Flags().StringVarP(
|
||||
&snapshot,
|
||||
"snapshot",
|
||||
"s",
|
||||
i18n.G("snapshot"),
|
||||
i18n.G("s"),
|
||||
"",
|
||||
"list specific snapshot",
|
||||
i18n.G("list specific snapshot"),
|
||||
)
|
||||
|
||||
AppBackupListCommand.Flags().BoolVarP(
|
||||
&showAllPaths,
|
||||
"all",
|
||||
"a",
|
||||
i18n.G("all"),
|
||||
i18n.G("a"),
|
||||
false,
|
||||
"show all paths",
|
||||
i18n.G("show all paths"),
|
||||
)
|
||||
|
||||
AppBackupListCommand.Flags().BoolVarP(
|
||||
×tamps,
|
||||
"timestamps",
|
||||
"t",
|
||||
i18n.G("timestamps"),
|
||||
i18n.G("t"),
|
||||
false,
|
||||
"include timestamps",
|
||||
i18n.G("include timestamps"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().StringVarP(
|
||||
&snapshot,
|
||||
"snapshot",
|
||||
"s",
|
||||
i18n.G("snapshot"),
|
||||
i18n.G("s"),
|
||||
"",
|
||||
"list specific snapshot",
|
||||
i18n.G("list specific snapshot"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().StringVarP(
|
||||
&includePath,
|
||||
"path",
|
||||
"p",
|
||||
i18n.G("path"),
|
||||
i18n.G("p"),
|
||||
"",
|
||||
"volumes path",
|
||||
i18n.G("volumes path"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().BoolVarP(
|
||||
&includeSecrets,
|
||||
"secrets",
|
||||
"S",
|
||||
i18n.G("secrets"),
|
||||
i18n.G("S"),
|
||||
false,
|
||||
"include secrets",
|
||||
i18n.G("include secrets"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().BoolVarP(
|
||||
&includeVolumes,
|
||||
"volumes",
|
||||
"v",
|
||||
i18n.G("volumes"),
|
||||
i18n.G("v"),
|
||||
false,
|
||||
"include volumes",
|
||||
i18n.G("include volumes"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().BoolVarP(
|
||||
&internal.Chaos,
|
||||
"chaos",
|
||||
"C",
|
||||
i18n.G("chaos"),
|
||||
i18n.G("C"),
|
||||
false,
|
||||
"ignore uncommitted recipes changes",
|
||||
i18n.G("ignore uncommitted recipes changes"),
|
||||
)
|
||||
|
||||
AppBackupCreateCommand.Flags().StringVarP(
|
||||
&retries,
|
||||
"retries",
|
||||
"r",
|
||||
i18n.G("retries"),
|
||||
i18n.G("r"),
|
||||
"1",
|
||||
"number of retry attempts",
|
||||
i18n.G("number of retry attempts"),
|
||||
)
|
||||
|
||||
AppBackupCreateCommand.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