Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using cmdns with cobra init'd app #4

Open
josegonzalez opened this issue Sep 7, 2017 · 6 comments
Open

Using cmdns with cobra init'd app #4

josegonzalez opened this issue Sep 7, 2017 · 6 comments

Comments

@josegonzalez
Copy link

I tried adding cmdns as displayed here in an app that was created via cobra init, but can't get the subcommands to work properly. Here is the output I get when trying to execute apps:info:

$ go run main.go apps:info
Error: unknown command "apps:info" for "pound"
Run 'pound --help' for usage.
unknown command "apps:info" for "pound"
exit status 1

Any pointers as to how I screwed this up would be great! I tried adding cmdns to both the RootCmd and the appsCmd to no avail :(

@kraman
Copy link

kraman commented Sep 28, 2017

Tracked it down to this change ... spf13/cobra#390

@josegonzalez
Copy link
Author

@kraman thanks for looking into this! I wouldn't know where to begin with "un-caching" the name. Maybe cobra should just support this subcommand method by default?

@kraman
Copy link

kraman commented Sep 28, 2017

Only place Name() being used is https://github.com/gosuri/cmdns/blob/master/cmdns.go#L113.
Probably just needs to split .Use and use it instead of calling Name()

@kraman
Copy link

kraman commented Sep 28, 2017

Looking a little further, I think the issue is that when the command is copied here https://github.com/gosuri/cmdns/blob/master/cmdns.go#L112, it also copies the cached name. If you only copy the public members, then it would work fine.

@kraman
Copy link

kraman commented Sep 28, 2017

The same issue maybe related to #2 as well

@dixudx
Copy link

dixudx commented Oct 11, 2017

Hi guys, FYI spf13/cobra#547.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants