From a5eead2268f423edf5f3528b76416ef052629a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 5 Oct 2023 00:06:36 -0400 Subject: [PATCH] cmd/incus/admin: Use translations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- cmd/incus/admin_init.go | 10 +++++----- cmd/incus/admin_recover.go | 12 ++++++------ cmd/incus/admin_shutdown.go | 12 ++++++------ cmd/incus/admin_sql.go | 12 ++++++------ cmd/incus/admin_waitready.go | 12 ++++++------ 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/cmd/incus/admin_init.go b/cmd/incus/admin_init.go index a9cb2dd9700..937fa85a9a6 100644 --- a/cmd/incus/admin_init.go +++ b/cmd/incus/admin_init.go @@ -10,6 +10,8 @@ import ( "github.com/spf13/cobra" "github.com/lxc/incus/client" + cli "github.com/lxc/incus/internal/cmd" + "github.com/lxc/incus/internal/i18n" "github.com/lxc/incus/internal/ports" internalUtil "github.com/lxc/incus/internal/util" "github.com/lxc/incus/internal/version" @@ -38,11 +40,9 @@ type cmdAdminInit struct { func (c *cmdAdminInit) Command() *cobra.Command { cmd := &cobra.Command{} - cmd.Use = "init" - cmd.Short = "Configure the daemon" - cmd.Long = `Description: - Configure the daemon -` + cmd.Use = usage("init") + cmd.Short = i18n.G("Configure the daemon") + cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`Configure the daemon`)) cmd.Example = ` init --minimal init --auto [--network-address=IP] [--network-port=8443] [--storage-backend=dir] [--storage-create-device=DEVICE] [--storage-create-loop=SIZE] diff --git a/cmd/incus/admin_recover.go b/cmd/incus/admin_recover.go index c0b10953e9a..4468c475c91 100644 --- a/cmd/incus/admin_recover.go +++ b/cmd/incus/admin_recover.go @@ -11,6 +11,8 @@ import ( "golang.org/x/text/language" "github.com/lxc/incus/client" + cli "github.com/lxc/incus/internal/cmd" + "github.com/lxc/incus/internal/i18n" "github.com/lxc/incus/internal/recover" "github.com/lxc/incus/shared/api" "github.com/lxc/incus/shared/validate" @@ -22,15 +24,13 @@ type cmdAdminRecover struct { func (c *cmdAdminRecover) Command() *cobra.Command { cmd := &cobra.Command{} - cmd.Use = "recover" - cmd.Short = "Recover missing instances and volumes from existing and unknown storage pools" - cmd.Long = `Description: - Recover missing instances and volumes from existing and unknown storage pools + cmd.Use = usage("recover") + cmd.Short = i18n.G("Recover missing instances and volumes from existing and unknown storage pools") + cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`Recover missing instances and volumes from existing and unknown storage pools This command is mostly used for disaster recovery. It will ask you about unknown storage pools and attempt to access them, along with existing storage pools, and identify any missing instances and volumes that exist on the - pools but are not in the database. It will then offer to recreate these database records. -` + pools but are not in the database. It will then offer to recreate these database records.`)) cmd.RunE = c.Run return cmd diff --git a/cmd/incus/admin_shutdown.go b/cmd/incus/admin_shutdown.go index fffdb1dc6c3..5df1b3b4923 100644 --- a/cmd/incus/admin_shutdown.go +++ b/cmd/incus/admin_shutdown.go @@ -12,6 +12,8 @@ import ( "github.com/spf13/cobra" "github.com/lxc/incus/client" + cli "github.com/lxc/incus/internal/cmd" + "github.com/lxc/incus/internal/i18n" ) type cmdAdminShutdown struct { @@ -23,17 +25,15 @@ type cmdAdminShutdown struct { func (c *cmdAdminShutdown) Command() *cobra.Command { cmd := &cobra.Command{} - cmd.Use = "shutdown" - cmd.Short = "Tell the daemon to shutdown all instances and exit" - cmd.Long = `Description: - Tell the daemon to shutdown all instances and exit + cmd.Use = usage("shutdown") + cmd.Short = i18n.G("Tell the daemon to shutdown all instances and exit") + cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`Tell the daemon to shutdown all instances and exit This will tell the daemon to start a clean shutdown of all instances, followed by having itself shutdown and exit. This can take quite a while as instances can take a long time to - shutdown, especially if a non-standard timeout was configured for them. -` + shutdown, especially if a non-standard timeout was configured for them.`)) cmd.RunE = c.Run cmd.Flags().IntVarP(&c.flagTimeout, "timeout", "t", 0, "Number of seconds to wait before giving up"+"``") cmd.Flags().BoolVarP(&c.flagForce, "force", "f", false, "Force shutdown instead of waiting for running operations to finish"+"``") diff --git a/cmd/incus/admin_sql.go b/cmd/incus/admin_sql.go index 73c6d837014..f4792701ec3 100644 --- a/cmd/incus/admin_sql.go +++ b/cmd/incus/admin_sql.go @@ -12,6 +12,8 @@ import ( "github.com/spf13/cobra" "github.com/lxc/incus/client" + cli "github.com/lxc/incus/internal/cmd" + "github.com/lxc/incus/internal/i18n" internalSQL "github.com/lxc/incus/internal/sql" "github.com/lxc/incus/shared/util" ) @@ -22,10 +24,9 @@ type cmdAdminSQL struct { func (c *cmdAdminSQL) Command() *cobra.Command { cmd := &cobra.Command{} - cmd.Use = "sql " - cmd.Short = "Execute a SQL query against the local or global database" - cmd.Long = `Description: - Execute a SQL query against the local or global database + cmd.Use = usage("sql", i18n.G(" ")) + cmd.Short = i18n.G("Execute a SQL query against the local or global database") + cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`Execute a SQL query against the local or global database The local database is specific to the cluster member you target the command to, and contains member-specific data (such as the member network @@ -51,8 +52,7 @@ func (c *cmdAdminSQL) Command() *cobra.Command { set of database queries to fix some data inconsistency. This command targets the global database and works in both local - and cluster mode. -` + and cluster mode.`)) cmd.RunE = c.Run cmd.Hidden = true diff --git a/cmd/incus/admin_waitready.go b/cmd/incus/admin_waitready.go index 962a500db54..3367766e59d 100644 --- a/cmd/incus/admin_waitready.go +++ b/cmd/incus/admin_waitready.go @@ -9,6 +9,8 @@ import ( "github.com/spf13/cobra" "github.com/lxc/incus/client" + cli "github.com/lxc/incus/internal/cmd" + "github.com/lxc/incus/internal/i18n" "github.com/lxc/incus/shared/logger" ) @@ -20,15 +22,13 @@ type cmdAdminWaitready struct { func (c *cmdAdminWaitready) Command() *cobra.Command { cmd := &cobra.Command{} - cmd.Use = "waitready" - cmd.Short = "Wait for the daemon to be ready to process requests" - cmd.Long = `Description: - Wait for the daemon to be ready to process requests + cmd.Use = usage("waitready") + cmd.Short = i18n.G("Wait for the daemon to be ready to process requests") + cmd.Long = cli.FormatSection(i18n.G("Description"), i18n.G(`Wait for the daemon to be ready to process requests This command will block until the daemon is reachable over its REST API and is done with early start tasks like re-starting previously started - containers. -` + containers.`)) cmd.RunE = c.Run cmd.Flags().IntVarP(&c.flagTimeout, "timeout", "t", 0, "Number of seconds to wait before giving up"+"``")