[Bug] `mr close` panics with index out of range [0] with length 0
glab mr close
panics when merge request ID is not provided.
Expected Behaviour
If the merge request id is not provided, glab
should find the open merge request for the current checked out branch and close it
Actual Behaviour
→ glab mr close
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/profclems/glab/commands/mr/close.NewCmdClose.func1(0xc0002e8580, 0x14a4e48, 0x0, 0x0, 0x0, 0x0)
github.com/profclems/glab/commands/mr/close/mr_close.go:43 +0x605
github.com/spf13/cobra.(*Command).execute(0xc0002e8580, 0x14a4e48, 0x0, 0x0, 0xc0002e8580, 0x14a4e48)
github.com/spf13/cobra@v1.0.0/command.go:842 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0xc000405080, 0xc000102160, 0x2, 0x2)
github.com/spf13/cobra@v1.0.0/command.go:950 +0x375
main.main()
github.com/profclems/glab/cmd/glab/main.go:114 +0x736
It works when merge request ID is provided
→ glab mr close 359
- Closing Merge request...✔ Merge request !359
!359 fix: error 500 when creating purchase order' (fix-err-500-purchase-order)
https://gitlab.com/ssisgh-projects/simeds/back-end/-/merge_requests/359