Skip to content
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

cli: report error if arguments are given for subcommands that require no arguments #205

Merged
merged 1 commit into from
Mar 3, 2022
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
1 change: 1 addition & 0 deletions cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Use with caution. This deletes everything and a startup afterwards is like the
initial startup of Colima.

If you simply want to reset the Kubernetes cluster, run 'colima kubernetes reset'.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
if !deleteCmdArgs.force {
y := cli.Prompt("are you sure you want to delete " + config.Profile().DisplayName + " and all settings")
Expand Down
4 changes: 4 additions & 0 deletions cmd/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var kubernetesStartCmd = &cobra.Command{
Use: "start",
Short: "start the Kubernetes cluster",
Long: `Start the Kubernetes cluster.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
app := newApp()
k, err := app.Kubernetes()
Expand All @@ -54,6 +55,7 @@ var kubernetesStopCmd = &cobra.Command{
Use: "stop",
Short: "stop the Kubernetes cluster",
Long: `Stop the Kubernetes cluster.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
app := newApp()
k, err := app.Kubernetes()
Expand All @@ -73,6 +75,7 @@ var kubernetesDeleteCmd = &cobra.Command{
Use: "delete",
Short: "delete the Kubernetes cluster",
Long: `Delete the Kubernetes cluster.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
app := newApp()
k, err := app.Kubernetes()
Expand All @@ -97,6 +100,7 @@ This resets the Kubernetes cluster and all Kubernetes objects
will be deleted.

The Kubernetes images are cached making the startup (after reset) much faster.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
app := newApp()
k, err := app.Kubernetes()
Expand Down
1 change: 1 addition & 0 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var listCmd = &cobra.Command{
Long: `List all created instances.

A new instance can be created during 'colima start' by specifying the '--profile' flag.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
instances, err := lima.Instances()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/nerdctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var nerdctlLinkFunc = func() *cobra.Command {
Use: "install",
Short: "install nerdctl alias script on the host",
Long: `Install nerdctl alias script on the host. The script will be installed at ` + nerdctlDefaultInstallPath + `.`,
Args: cobra.NoArgs,
PreRun: func(cmd *cobra.Command, args []string) {
// check if /usr/local/bin is writeable and no need for sudo

Expand Down
1 change: 1 addition & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The --runtime, --disk and --arch flags are only used on initial start and ignore
" colima start --cpu 4 --memory 8 --disk 100\n" +
" colima start --arch aarch64\n" +
" colima start --dns 1.1.1.1 --dns 8.8.8.8",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return newApp().Start(startCmdArgs.Config)
},
Expand Down
1 change: 1 addition & 0 deletions cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var statusCmd = &cobra.Command{
Use: "status",
Short: "show the status of Colima",
Long: `Show the status of Colima`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return newApp().Status()
},
Expand Down
1 change: 1 addition & 0 deletions cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var stopCmd = &cobra.Command{

The state of the VM is persisted at stop. A start afterwards
should return it back to its previous state.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return newApp().Stop()
},
Expand Down
1 change: 1 addition & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "print the version of Colima",
Long: `Print the version of Colima`,
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
version := config.AppVersion()
fmt.Println(config.AppName, "version", version.Version)
Expand Down