Skip to content

Commit

Permalink
cmd/incus/admin: Use translations
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Oct 5, 2023
1 parent 606591f commit a5eead2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions cmd/incus/admin_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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]
Expand Down
12 changes: 6 additions & 6 deletions cmd/incus/admin_recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions cmd/incus/admin_shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"+"``")
Expand Down
12 changes: 6 additions & 6 deletions cmd/incus/admin_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -22,10 +24,9 @@ type cmdAdminSQL struct {

func (c *cmdAdminSQL) Command() *cobra.Command {
cmd := &cobra.Command{}
cmd.Use = "sql <local|global> <query>"
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("<local|global> <query>"))
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
Expand All @@ -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

Expand Down
12 changes: 6 additions & 6 deletions cmd/incus/admin_waitready.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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"+"``")

Expand Down

0 comments on commit a5eead2

Please sign in to comment.