Skip to content

Group flags in Available Commands #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions cli/cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import (
"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(completionCmd)
}

var completionCmd = &cobra.Command{
Use: "completion",
Short: "generate bash completion scripts",
Expand Down
1 change: 0 additions & 1 deletion cli/cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
)

func init() {
rootCmd.AddCommand(configureCmd)
addEnvFlag(configureCmd)
}

Expand Down
1 change: 0 additions & 1 deletion cli/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
var flagKeepCache bool

func init() {
rootCmd.AddCommand(deleteCmd)
deleteCmd.PersistentFlags().BoolVarP(&flagKeepCache, "keep-cache", "c", false, "keep cached data for the app")
addEnvFlag(deleteCmd)
}
Expand Down
1 change: 0 additions & 1 deletion cli/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
var flagDeployForce bool

func init() {
rootCmd.AddCommand(deployCmd)
deployCmd.PersistentFlags().BoolVarP(&flagDeployForce, "force", "f", false, "stop all running jobs")
addEnvFlag(deployCmd)
}
Expand Down
1 change: 0 additions & 1 deletion cli/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
)

func init() {
rootCmd.AddCommand(getCmd)
addAppNameFlag(getCmd)
addEnvFlag(getCmd)
addResourceTypesToHelp(getCmd)
Expand Down
4 changes: 0 additions & 4 deletions cli/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ import (
"github.com/cortexlabs/cortex/pkg/utils/util"
)

func init() {
rootCmd.AddCommand(initCmd)
}

var initCmd = &cobra.Command{
Use: "init APP_NAME",
Short: "initialize an application",
Expand Down
1 change: 0 additions & 1 deletion cli/cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
)

func init() {
rootCmd.AddCommand(logsCmd)
addAppNameFlag(logsCmd)
addEnvFlag(logsCmd)
addResourceTypesToHelp(logsCmd)
Expand Down
1 change: 0 additions & 1 deletion cli/cmd/predict.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
)

func init() {
rootCmd.AddCommand(predictCmd)
addAppNameFlag(predictCmd)
addEnvFlag(predictCmd)
}
Expand Down
1 change: 0 additions & 1 deletion cli/cmd/refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
var flagRefreshForce bool

func init() {
rootCmd.AddCommand(refreshCmd)
refreshCmd.PersistentFlags().BoolVarP(&flagRefreshForce, "force", "f", false, "stop all running jobs")
addEnvFlag(refreshCmd)
}
Expand Down
15 changes: 15 additions & 0 deletions cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ var rootCmd = &cobra.Command{
func Execute() {
defer errors.RecoverAndExit()
rootCmd.SetHelpCommand(&cobra.Command{Hidden: true})
cobra.EnableCommandSorting = false

rootCmd.AddCommand(initCmd)
rootCmd.AddCommand(deployCmd)
rootCmd.AddCommand(refreshCmd)
rootCmd.AddCommand(predictCmd)
rootCmd.AddCommand(deleteCmd)

rootCmd.AddCommand(getCmd)
rootCmd.AddCommand(statusCmd)
rootCmd.AddCommand(logsCmd)

rootCmd.AddCommand(configureCmd)
rootCmd.AddCommand(completionCmd)

rootCmd.Execute()
}

Expand Down
1 change: 0 additions & 1 deletion cli/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
)

func init() {
rootCmd.AddCommand(statusCmd)
addAppNameFlag(statusCmd)
addEnvFlag(statusCmd)
addResourceTypesToHelp(statusCmd)
Expand Down