From 8a3f0032aec648b9c8261e3df0401891fa5f6692 Mon Sep 17 00:00:00 2001 From: Pavel Sviderski Date: Thu, 31 Oct 2024 20:07:25 +1000 Subject: [PATCH] format machine command flags --- cmd/uncloud/machine/add.go | 6 +++--- cmd/uncloud/machine/init.go | 14 +++++++------- cmd/uncloud/machine/list.go | 4 ++-- cmd/uncloud/machine/token.go | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/uncloud/machine/add.go b/cmd/uncloud/machine/add.go index fcff4a6c..4750f24b 100644 --- a/cmd/uncloud/machine/add.go +++ b/cmd/uncloud/machine/add.go @@ -36,14 +36,14 @@ func NewAddCommand() *cobra.Command { return uncli.AddMachine(cmd.Context(), remoteMachine, opts.cluster, opts.name) }, } - cmd.Flags().StringVarP(&opts.name, "name", "n", "", "Assign a name to the machine") + cmd.Flags().StringVarP(&opts.name, "name", "n", "", "Assign a name to the machine.") cmd.Flags().StringVarP( &opts.sshKey, "ssh-key", "i", "", - "path to SSH private key for SSH remote login (default ~/.ssh/id_*)", + "path to SSH private key for SSH remote login. (default ~/.ssh/id_*)", ) cmd.Flags().StringVarP( &opts.cluster, "cluster", "c", "", - "Name of the cluster to add the machine to (default is the current cluster)", + "Name of the cluster to add the machine to. (default is the current cluster)", ) return cmd } diff --git a/cmd/uncloud/machine/init.go b/cmd/uncloud/machine/init.go index b72d0746..a92f7206 100644 --- a/cmd/uncloud/machine/init.go +++ b/cmd/uncloud/machine/init.go @@ -19,10 +19,10 @@ type initOptions struct { func NewInitCommand() *cobra.Command { opts := initOptions{} cmd := &cobra.Command{ - Use: "init [USER@HOST:PORT]", - Args: cobra.MaximumNArgs(1), - // TODO: include usage examples of initialising a local and remote machine. + Use: "init [USER@HOST:PORT]", Short: "Initialise a new cluster that consists of the local or remote machine.", + // TODO: include usage examples of initialising a local and remote machine. + Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { uncli := cmd.Context().Value("cli").(*cli.CLI) @@ -47,18 +47,18 @@ func NewInitCommand() *cobra.Command { return uncli.InitCluster(cmd.Context(), remoteMachine, opts.cluster, opts.name, netPrefix) }, } - cmd.Flags().StringVarP(&opts.name, "name", "n", "", "Assign a name to the machine") + cmd.Flags().StringVarP(&opts.name, "name", "n", "", "Assign a name to the machine.") cmd.Flags().StringVar( &opts.network, "network", network.DefaultNetwork.String(), - "IPv4 network CIDR to use for machines and services", + "IPv4 network CIDR to use for machines and services.", ) cmd.Flags().StringVarP( &opts.sshKey, "ssh-key", "i", "", - "path to SSH private key for SSH remote login (default ~/.ssh/id_*)", + "path to SSH private key for SSH remote login. (default ~/.ssh/id_*)", ) cmd.Flags().StringVarP( &opts.cluster, "cluster", "c", "", - "Name of the cluster in the local config if initialising a remote machine", + "Name of the cluster in the local config if initialising a remote machine.", ) return cmd diff --git a/cmd/uncloud/machine/list.go b/cmd/uncloud/machine/list.go index e939a1ae..02fbba15 100644 --- a/cmd/uncloud/machine/list.go +++ b/cmd/uncloud/machine/list.go @@ -10,7 +10,7 @@ func NewListCommand() *cobra.Command { cmd := &cobra.Command{ Use: "ls", Aliases: []string{"list"}, - Short: "List machines in a cluster", + Short: "List machines in a cluster.", RunE: func(cmd *cobra.Command, args []string) error { uncli := cmd.Context().Value("cli").(*cli.CLI) return uncli.ListMachines(cmd.Context(), cluster) @@ -18,7 +18,7 @@ func NewListCommand() *cobra.Command { } cmd.Flags().StringVarP( &cluster, "cluster", "c", "", - "Name of the cluster (default is the current cluster)", + "Name of the cluster. (default is the current cluster)", ) return cmd } diff --git a/cmd/uncloud/machine/token.go b/cmd/uncloud/machine/token.go index a60f2d00..af274817 100644 --- a/cmd/uncloud/machine/token.go +++ b/cmd/uncloud/machine/token.go @@ -31,7 +31,7 @@ func NewTokenCommand() *cobra.Command { } cmd.Flags().StringVarP(&opts.dataDir, "data-dir", "d", machine.DefaultDataDir, - "Directory for storing persistent machine state") + "Directory for storing persistent machine state.") _ = cmd.MarkFlagDirname("data-dir") return cmd