drush
drush copied to clipboard
documentation for migrate:import --progress option is unclear
Describe the bug
drush help mim says:
--progress[=PROGRESS] Show progress bar [default: true]
Reading this, I assumed I'd say --progress=false to turn it off, since it gives 'true' as the default. However that didn't work. What did work as --progress=0
Also, the examples have:
--no-progress
which isn't given in the list of options.
The code only has this:
* @option progress Show progress bar
So this looks to me like a bug in the way command help documentation is derived from the code.
To Reproduce What did you do?
Expected behavior What did you expect would happen?
Actual behavior What happened instead?
Workaround Is there another way to do the desired action?
System Configuration
| Q | A |
|---|---|
| Drush version? | 11.x/10.x/8.x (please be specific, and try latest release) |
| Drupal version? | 10.x/9.x/8.x/7.x |
| PHP version | 8.x/7.x |
| OS? | Mac/Linux/Windows |
Additional information Add any other context about the problem here.
@joachim-n , this is how it suppose to work. Please see https://github.com/consolidation/annotated-command#option-default-values, the The special value true produces the following behavior: section
Particularly...
If the user adds
--no-fooon the commandline, then the value offoowill befalse.
As --no-progress is documented in the usage examples, it should be enough. Or should we extend the docs of @option progress?
Or should we extend the docs of @option progress?
Extend, and fix, I'd say.
--progress[=PROGRESS]
The [=PROGRESS] makes no sense here, since you give this option without a value.
And it should say something like 'enabled by default. Negate with --no-progress'.
The [=PROGRESS] makes no sense here, since you give this option without a value
That is added automatically. How to get rid of?
That's what I mean -- the code that adds this automatically has a bug.
But is that code Drush? I think it's https://github.com/consolidation/annotated-command
I looked into this a bit. The default value of true does accept a string, so the [=PROGRESS] is rightly shown. If we dont want a value, I'm not sure that annotated-command provides a good option for us. In 12.x branch, we could potentially expand the Option Attribute to indicate \Symfony\Component\Console\Input\InputOption::VALUE_NONE.
We might also be able to improve behavior a bit in Drush 12 if we use InputOption::VALUE_NEGATABLE. I haven't looked into supporting this in Annotated Commands much yet.
Related https://github.com/drush-ops/drush/issues/4825#issuecomment-918695596
The default value of true does accept a string, so the [=PROGRESS] is rightly shown
Indeed, but it's confusing that specifying '=false' counts as truthy!