Skip to content

coder update cli command doesn't explain it needs an arg #3299

Closed
@spikecurtis

Description

@spikecurtis

Problem

% coder update -h
Update a workspace to the latest template version

Usage:
  coder update [flags]

This usage is incorrect, as it needs a workspace name as an arg.

Also, we panic instead of giving an error message when you run it without a workspace name

% coder update
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/coder/coder/cli.update.func1(0x1400079e000, {0x10c681598, 0x0, 0x0?})
	/Users/spike/repos/coder/cli/update.go:28 +0x52c
github.com/spf13/cobra.(*Command).execute(0x1400079e000, {0x10c681598, 0x0, 0x0})
	/Users/spike/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:872 +0x4d0
github.com/spf13/cobra.(*Command).ExecuteC(0x14000720c80)
	/Users/spike/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x354
main.main()
	/Users/spike/repos/coder/cmd/coder/main.go:18 +0xa8

Acceptance criteria

  1. usage should be coder update <workspace> [flags]
  2. running coder update with no args should throw an error (or prompt user for workspace)

Metadata

Metadata

Assignees

Labels

cliArea: CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions