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

getValue() not working #75

Open
jameswithers opened this issue May 22, 2017 · 2 comments
Open

getValue() not working #75

jameswithers opened this issue May 22, 2017 · 2 comments

Comments

@jameswithers
Copy link

echo $command['n] successfully returns what's passed as -n, but $command->getOption('n')->getValue() returns nothing

@agmckee
Copy link

agmckee commented Aug 17, 2017

I also ran into this issue.

@NeoVance
Copy link
Contributor

You must run the parse function to parse the args before you can get an options value. It happens that the array access function automatically runs the parse function.

Parsing the arguments can be an expensive operation depending on the command, and the options being used. It is designed to execute lazily, and only once.

use isParsed to find out if the arguments have been parsed. The option value will not be set yet if it returns false.

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