cli: fix command order and minor wording tweaks in config cmd

This commit is contained in:
Thomas Tendyck 2022-05-24 11:56:40 +02:00 committed by Thomas Tendyck
parent 88ec7397c9
commit 9f0c751f1b
4 changed files with 6 additions and 4 deletions

View File

@ -8,7 +8,7 @@ func newConfigCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "config", Use: "config",
Short: "Work with the Constellation configuration file", Short: "Work with the Constellation configuration file",
Long: "Generate & manipulate configuration file for Constellation.", Long: "Generate a configuration file for Constellation.",
Args: cobra.ExactArgs(0), Args: cobra.ExactArgs(0),
} }

View File

@ -23,7 +23,7 @@ func newConfigGenerateCmd() *cobra.Command {
ValidArgsFunction: generateCompletion, ValidArgsFunction: generateCompletion,
RunE: runConfigGenerate, RunE: runConfigGenerate,
} }
cmd.Flags().StringP("file", "f", constants.ConfigFilename, "output file") cmd.Flags().StringP("file", "f", constants.ConfigFilename, "path to output file, or '-' for stdout")
return cmd return cmd
} }

View File

@ -30,16 +30,16 @@ func NewRootCmd() *cobra.Command {
// Set output of cmd.Print to stdout. (By default, it's stderr.) // Set output of cmd.Print to stdout. (By default, it's stderr.)
rootCmd.SetOut(os.Stdout) rootCmd.SetOut(os.Stdout)
rootCmd.PersistentFlags().String("config", constants.ConfigFilename, "use settings from a config") rootCmd.PersistentFlags().String("config", constants.ConfigFilename, "path to the configuration file")
must(rootCmd.MarkPersistentFlagFilename("config", "json")) must(rootCmd.MarkPersistentFlagFilename("config", "json"))
rootCmd.AddCommand(newConfigCmd())
rootCmd.AddCommand(newCreateCmd()) rootCmd.AddCommand(newCreateCmd())
rootCmd.AddCommand(newInitCmd()) rootCmd.AddCommand(newInitCmd())
rootCmd.AddCommand(newVerifyCmd()) rootCmd.AddCommand(newVerifyCmd())
rootCmd.AddCommand(newRecoverCmd()) rootCmd.AddCommand(newRecoverCmd())
rootCmd.AddCommand(newTerminateCmd()) rootCmd.AddCommand(newTerminateCmd())
rootCmd.AddCommand(newVersionCmd()) rootCmd.AddCommand(newVersionCmd())
rootCmd.AddCommand(newConfigCmd())
return rootCmd return rootCmd
} }

View File

@ -7,10 +7,12 @@ import (
"regexp" "regexp"
"github.com/edgelesssys/constellation/cli/cmd" "github.com/edgelesssys/constellation/cli/cmd"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {
cobra.EnableCommandSorting = false
rootCmd := cmd.NewRootCmd() rootCmd := cmd.NewRootCmd()
rootCmd.DisableAutoGenTag = true rootCmd.DisableAutoGenTag = true