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:
@ -7,13 +7,14 @@ import (
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var AppBackupListCommand = &cobra.Command{
|
||||
Use: "list <domain> [flags]",
|
||||
Aliases: []string{"ls"},
|
||||
Short: "List the contents of a snapshot",
|
||||
Use: gotext.Get("list <domain> [flags]"),
|
||||
Aliases: []string{gotext.Get("ls")},
|
||||
Short: gotext.Get("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(gotext.Get("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(gotext.Get("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(gotext.Get("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: gotext.Get("download <domain> [flags]"),
|
||||
Aliases: []string{gotext.Get("d")},
|
||||
Short: gotext.Get("Download a snapshot"),
|
||||
Long: gotext.Get(`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(gotext.Get("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(gotext.Get("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(gotext.Get("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(gotext.Get("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: gotext.Get("create <domain> [flags]"),
|
||||
Aliases: []string{gotext.Get("c")},
|
||||
Short: gotext.Get("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(gotext.Get("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]",
|
||||
Use: gotext.Get("snapshots <domain> [flags]"),
|
||||
Aliases: []string{"s"},
|
||||
Short: "List all snapshots",
|
||||
Short: gotext.Get("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: gotext.Get("backup [cmd] [args] [flags]"),
|
||||
Aliases: []string{gotext.Get("b")},
|
||||
Short: gotext.Get("Manage app backups"),
|
||||
}
|
||||
|
||||
var (
|
||||
@ -230,7 +231,7 @@ func init() {
|
||||
"snapshot",
|
||||
"s",
|
||||
"",
|
||||
"list specific snapshot",
|
||||
gotext.Get("list specific snapshot"),
|
||||
)
|
||||
|
||||
AppBackupListCommand.Flags().BoolVarP(
|
||||
@ -238,7 +239,7 @@ func init() {
|
||||
"all",
|
||||
"a",
|
||||
false,
|
||||
"show all paths",
|
||||
gotext.Get("show all paths"),
|
||||
)
|
||||
|
||||
AppBackupListCommand.Flags().BoolVarP(
|
||||
@ -246,7 +247,7 @@ func init() {
|
||||
"timestamps",
|
||||
"t",
|
||||
false,
|
||||
"include timestamps",
|
||||
gotext.Get("include timestamps"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().StringVarP(
|
||||
@ -254,7 +255,7 @@ func init() {
|
||||
"snapshot",
|
||||
"s",
|
||||
"",
|
||||
"list specific snapshot",
|
||||
gotext.Get("list specific snapshot"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().StringVarP(
|
||||
@ -262,7 +263,7 @@ func init() {
|
||||
"path",
|
||||
"p",
|
||||
"",
|
||||
"volumes path",
|
||||
gotext.Get("volumes path"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().BoolVarP(
|
||||
@ -270,7 +271,7 @@ func init() {
|
||||
"secrets",
|
||||
"S",
|
||||
false,
|
||||
"include secrets",
|
||||
gotext.Get("include secrets"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().BoolVarP(
|
||||
@ -278,7 +279,7 @@ func init() {
|
||||
"volumes",
|
||||
"v",
|
||||
false,
|
||||
"include volumes",
|
||||
gotext.Get("include volumes"),
|
||||
)
|
||||
|
||||
AppBackupDownloadCommand.Flags().BoolVarP(
|
||||
@ -286,7 +287,7 @@ func init() {
|
||||
"chaos",
|
||||
"C",
|
||||
false,
|
||||
"ignore uncommitted recipes changes",
|
||||
gotext.Get("ignore uncommitted recipes changes"),
|
||||
)
|
||||
|
||||
AppBackupCreateCommand.Flags().StringVarP(
|
||||
@ -294,7 +295,7 @@ func init() {
|
||||
"retries",
|
||||
"r",
|
||||
"1",
|
||||
"number of retry attempts",
|
||||
gotext.Get("number of retry attempts"),
|
||||
)
|
||||
|
||||
AppBackupCreateCommand.Flags().BoolVarP(
|
||||
@ -302,6 +303,6 @@ func init() {
|
||||
"chaos",
|
||||
"C",
|
||||
false,
|
||||
"ignore uncommitted recipes changes",
|
||||
gotext.Get("ignore uncommitted recipes changes"),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user