commando icon indicating copy to clipboard operation
commando copied to clipboard

getValue() not working

Open jameswithers opened this issue 8 years ago • 2 comments

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

jameswithers avatar May 22 '17 08:05 jameswithers

I also ran into this issue.

agmckee avatar Aug 17 '17 15:08 agmckee

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.

NeoVance avatar Sep 23 '17 05:09 NeoVance