all.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package commands
  2. import (
  3. "fmt"
  4. "github.com/porter-dev/porter/cli/cmd/config"
  5. "github.com/porter-dev/porter/cli/cmd/utils"
  6. "github.com/spf13/cobra"
  7. )
  8. // RegisterCommands initiates config and sets up all commands.
  9. // Error returned here is a placeholder as the register commands do not currently return errors, and handle exits themselves. This may change at a later date.
  10. func RegisterCommands() (*cobra.Command, error) {
  11. cliConf, err := config.InitAndLoadConfig()
  12. if err != nil {
  13. return nil, fmt.Errorf("error loading porter config: %w", err)
  14. }
  15. rootCmd := &cobra.Command{
  16. Use: "porter",
  17. Short: "Porter is a dashboard for managing Kubernetes clusters.",
  18. Long: `Porter is a tool for creating, versioning, and updating Kubernetes deployments using a visual dashboard. For more information, visit github.com/porter-dev/porter`,
  19. }
  20. rootCmd.PersistentFlags().AddFlagSet(utils.DefaultFlagSet)
  21. rootCmd.AddCommand(registerCommand_App(cliConf))
  22. rootCmd.AddCommand(registerCommand_Apply(cliConf))
  23. rootCmd.AddCommand(registerCommand_Auth(cliConf))
  24. rootCmd.AddCommand(registerCommand_Cluster(cliConf))
  25. rootCmd.AddCommand(registerCommand_Config(cliConf))
  26. rootCmd.AddCommand(registerCommand_Connect(cliConf))
  27. rootCmd.AddCommand(registerCommand_Create(cliConf))
  28. rootCmd.AddCommand(registerCommand_Delete(cliConf))
  29. rootCmd.AddCommand(registerCommand_Deploy(cliConf))
  30. rootCmd.AddCommand(registerCommand_Docker(cliConf))
  31. rootCmd.AddCommand(registerCommand_Get(cliConf))
  32. rootCmd.AddCommand(registerCommand_Helm(cliConf))
  33. rootCmd.AddCommand(registerCommand_Job(cliConf))
  34. rootCmd.AddCommand(registerCommand_Kubectl(cliConf))
  35. rootCmd.AddCommand(registerCommand_List(cliConf))
  36. rootCmd.AddCommand(registerCommand_Logs(cliConf))
  37. rootCmd.AddCommand(registerCommand_Open(cliConf))
  38. rootCmd.AddCommand(registerCommand_PortForward(cliConf))
  39. rootCmd.AddCommand(registerCommand_Project(cliConf))
  40. rootCmd.AddCommand(registerCommand_Registry(cliConf))
  41. rootCmd.AddCommand(registerCommand_Run(cliConf))
  42. rootCmd.AddCommand(registerCommand_Server(cliConf))
  43. rootCmd.AddCommand(registerCommand_Stack(cliConf))
  44. rootCmd.AddCommand(registerCommand_Update(cliConf))
  45. rootCmd.AddCommand(registerCommand_Version(cliConf))
  46. return rootCmd, nil
  47. }