on windows, how to execute go bin commands of go cobra package?

336 Views Asked by At

I am studying go cobra

I need to execute, on windows, the equivalent of

~/go/bin/cobra init

I already did

 go get -u github.com/spf13/cobra/cobra

I don't know how to execute the bin/cobra command because I don't know where it's installed now the cobra package

In my laptop I've this folder

C:\Users\mirko\go\bin 

But there is no cobra command. What I am supposed to do on Windows when starting a project from scratch with cobra?

1

There are 1 best solutions below

0
realtebo On BEST ANSWER

Thanks to comment of @JimB I followd the project readme here

First, init a module

go mod init <package name>

I installed the cobra dep as

go get -u github.com/spf13/cobra@latest

Then I installed as is the cobra cli

go install github.com/spf13/cobra-cli@latest

Another usefull REAMDE is here, about cobra-cli

I can init the cobra project structure using

cobra-cli init

And the I can create commands like ..

cobra-cli add list
cobra-cli add delete 
...