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

invalid input ignored at end of a valid cobra command #1011

Closed
rathorea opened this issue Jan 3, 2020 · 3 comments
Closed

invalid input ignored at end of a valid cobra command #1011

rathorea opened this issue Jan 3, 2020 · 3 comments

Comments

@rathorea
Copy link

rathorea commented Jan 3, 2020

Hi All,

I have defined a command that should look like this:
./binary param1 param2

So when the user enters this:
./binary param1 param2 paramX

The parser code somehow ignores paramX and executes the command as if user had entered:
./binary param1 param2

What am I missing? Any suggested way to fix this?

Thanks

@umarcor
Copy link
Contributor

umarcor commented Jan 4, 2020

@rathorea, see https://github.com/spf13/cobra#positional-and-custom-arguments for instructions of how to limit the number of accepted parameters to two. I think that you might want to use ExactArgs and, optionally, ExactValidArgs.

Ref #841

@github-actions
Copy link

github-actions bot commented Apr 3, 2020

This issue is being marked as stale due to a long period of inactivity

@johnSchnake
Copy link
Collaborator

Seems asked and answered; closing.

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