drush icon indicating copy to clipboard operation
drush copied to clipboard

documentation for migrate:import --progress option is unclear

Open joachim-n opened this issue 2 years ago • 10 comments

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 avatar Mar 13 '23 16:03 joachim-n

@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

claudiu-cristea avatar Mar 13 '23 16:03 claudiu-cristea

Particularly...

If the user adds --no-foo on the commandline, then the value of foo will be false.

As --no-progress is documented in the usage examples, it should be enough. Or should we extend the docs of @option progress?

claudiu-cristea avatar Mar 13 '23 16:03 claudiu-cristea

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'.

joachim-n avatar Mar 13 '23 16:03 joachim-n

The [=PROGRESS] makes no sense here, since you give this option without a value

That is added automatically. How to get rid of?

claudiu-cristea avatar Mar 13 '23 16:03 claudiu-cristea

That's what I mean -- the code that adds this automatically has a bug.

joachim-n avatar Mar 13 '23 16:03 joachim-n

But is that code Drush? I think it's https://github.com/consolidation/annotated-command

claudiu-cristea avatar Mar 13 '23 16:03 claudiu-cristea

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.

weitzman avatar Mar 14 '23 01:03 weitzman

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.

greg-1-anderson avatar Mar 14 '23 02:03 greg-1-anderson

Related https://github.com/drush-ops/drush/issues/4825#issuecomment-918695596

weitzman avatar Mar 15 '23 03:03 weitzman

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!

joachim-n avatar Mar 20 '23 15:03 joachim-n