Open mjordan opened 8 years ago
When you access the command values it actually parses the argument list, and sets the values for every option. At this time there is a flag preventing it from re-parsing after the first run. If your "c" option is not last than it is causing the argument list to be parsed before you create the rest of your options and define their features.
there may be a viable option to work around this, but I don't know if there is any plan to implement it.
I want to set the default value for a
->file()
option based on the value of another option. This appears to work only if the->file()
option is the last one defined. Examples:Running
./file_test.php -n 10 -t foo /tmp
does not produce an error. But if set the default value of the->file()
option based on the value of another option:running
./file_test.php -n 10 -t foo /tmp
producesERROR: Unknown option, n, specified
.However, if the
->file()
option is the last option defined, its default value can be dynamically generated:Running
./file_test.php -n 10 -t foo /tmp
does not produce an error.Is this expected behavior, or am I missing something obvious?