michaellihs / golab

Gitlab CLI written in Go
MIT License
27 stars 2 forks source link

golab project edit - should show cobra Usage if executed with empty flags #5

Open bzon opened 6 years ago

bzon commented 6 years ago

This is the first time that I used this cli and I was trying to play around with the sub commands.

Commands:

golab project edit                                                                                                                                               
golab project hooks add
golab project hooks edit

Output:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13e1f73]

goroutine 1 [running]:
github.com/michaellihs/golab/cmd.glob..func76(0x17b7460, 0x17e85b8, 0x0, 0x0, 0x0, 0x0)
    /Users/john.bryan.j.sazon/Golang/src/github.com/michaellihs/golab/cmd/project.go:203 +0x103
github.com/michaellihs/golab/vendor/github.com/spf13/cobra.(*Command).execute(0x17b7460, 0x17e85b8, 0x0, 0x0, 0x17b7460, 0x17e85b8)
    /Users/john.bryan.j.sazon/Golang/src/github.com/michaellihs/golab/vendor/github.com/spf13/cobra/command.go:700 +0x46d
github.com/michaellihs/golab/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x17bf1c0, 0x54, 0x1527f38, 0x1527f30)
    /Users/john.bryan.j.sazon/Golang/src/github.com/michaellihs/golab/vendor/github.com/spf13/cobra/command.go:785 +0x2e4
github.com/michaellihs/golab/vendor/github.com/spf13/cobra.(*Command).Execute(0x17bf1c0, 0x0, 0x13e6bf3)
    /Users/john.bryan.j.sazon/Golang/src/github.com/michaellihs/golab/vendor/github.com/spf13/cobra/command.go:738 +0x2b
github.com/michaellihs/golab/cmd.Execute()
    /Users/john.bryan.j.sazon/Golang/src/github.com/michaellihs/golab/cmd/root.go:50 +0x32
main.main()
    /Users/john.bryan.j.sazon/Golang/src/github.com/michaellihs/golab/main.go:28 +0x20
michaellihs commented 6 years ago

Hi @bzon - sorry for taking me so long to get back on this one. Thanks for reporting this to me, I will try to find some time during the next days to fix it.

If you want to help out, feel free to open up a pull request with a fix - I will gladly merge it after a review.

michaellihs commented 6 years ago

Hi @bzon - I finally found some time to fix this - see issue/5 branch. Would be great if you could test it.