mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-21 13:08:07 -04:00
Use function for commands
instead of func init() and global var
This commit is contained in:
parent
54319e4324
commit
409f6fec65
2 changed files with 27 additions and 27 deletions
|
@ -7,21 +7,23 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "cdbg",
|
||||
Short: "Constellation debugging client",
|
||||
Long: `cdbg is the constellation debugging client.
|
||||
It connects to CoreOS instances running debugd and deploys a self-compiled version of the bootstrapper.`,
|
||||
func newRootCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "cdbg",
|
||||
Short: "Constellation debugging client",
|
||||
Long: `cdbg is the constellation debugging client.
|
||||
It connects to CoreOS instances running debugd and deploys a self-compiled version of the bootstrapper.`,
|
||||
}
|
||||
cmd.PersistentFlags().String("config", constants.ConfigFilename, "Constellation config file")
|
||||
cmd.PersistentFlags().String("cdbg-config", constants.DebugdConfigFilename, "debugd config file")
|
||||
cmd.AddCommand(newDeployCmd())
|
||||
return cmd
|
||||
}
|
||||
|
||||
// Execute starts the CLI.
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
cmd := newRootCmd()
|
||||
if err := cmd.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().String("config", constants.ConfigFilename, "Constellation config file")
|
||||
rootCmd.PersistentFlags().String("cdbg-config", constants.DebugdConfigFilename, "debugd config file")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue