When you run drush sql-cli, the underlying mysql process can display information about the -A argument:

[16:07:01] root@ded-66.bjaspan:~# drush @dbimport.dev sql-cli -A
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
...

This isn't drush's fault, but it could confuse users. Perhaps the simplest solution is for sql-cli to accept the -A arg and pass it on to mysql.

Comments

posulliv’s picture

Version: » 8.x-6.x-dev
StatusFileSize
new1009 bytes

Attached is a patch to add an option that only applies to MySQL for the sql-cli command.

greg.1.anderson’s picture

Maybe a better option would be to make sql-cli a strict options command. See drush topic docs-strict-options and the implementation of the core-rsync command.

greg.1.anderson’s picture

Status: Active » Needs work

Adjusting status.

moshe weitzman’s picture

Strict options is a usability fail for me. I want us to use that only when we really need it on a given command.

greg.1.anderson’s picture

Okay, we would not have to use strict options; we could instead set 'allow-additional-options' => TRUE on sql-cli, which would allow us to use drush_get_option('A') instead of drush_get_option('skip-metadata'), as in #1, which would allow the option to match the message. That would fix just the issue described by the OP; if we used strict options, we could also pass through other mysql options.

posulliv’s picture

Assigned: Unassigned » posulliv
StatusFileSize
new5.68 KB

Thanks for the feedback and direction. Attached is a patch that uses the allow-additional-options strategy.

posulliv’s picture

StatusFileSize
new792 bytes

My bad, I needed to rebase my branch so there is some extra diffs in the patch in #6. Correct patch attached to this comment.

posulliv’s picture

StatusFileSize
new792 bytes
greg.1.anderson’s picture

Does it also work if you leave off the 'allow-additional-options' and just set 'A' as an option? Don't have time to run the experiment right now, but I was just thinking that would work. The thing about that is that drush help sql-cli would then report that the option was --A instead of -A; however, I think that -A still works.

I'm not sure which is less confusing. At a minimum, I think that we should have an example (in the 'examples' section of sql-cli) that uses the -A option.

Thanks for working on this.

posulliv’s picture

StatusFileSize
new1.22 KB

This patch removes the allow-additional-options and it does indeed work as you expected.

So both -A and --A have the same effect now when passed as an option.

I also added an example.

moshe weitzman’s picture

Status: Needs work » Fixed

committed to 5 and 6 branches. thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.