Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.
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: 4 additions & 0 deletions .changelog/4019.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
cli: Fix panic in cli for `waypoint task cancel` if attempting to cancel by run
job id with no argument.
```
12 changes: 7 additions & 5 deletions internal/cli/task_cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ func (c *TaskCancelCommand) Run(args []string) int {
}
ctx := c.Ctx

if len(c.args) == 0 && c.flagRunJobId == "" {
c.ui.Output("Task ID or Run Job Id required.\n\n%s", c.Help(), terminal.WithErrorStyle())
return 1
var taskId string
if len(c.args) > 0 {
taskId = c.args[0]
}
taskId := c.args[0]

if c.flagRunJobId != "" && taskId != "" {
if taskId == "" && c.flagRunJobId == "" {
c.ui.Output("Task Id or Run Job Id required.\n\n%s", c.Help(), terminal.WithErrorStyle())
return 1
} else if c.flagRunJobId != "" && taskId != "" {
c.ui.Output("Both Run Job Id and Task Id was supplied, will look up by Task Id", terminal.WithWarningStyle())
}

Expand Down