It has bothered me for a while that `drush @site1,@site2 status` repeats the drush information for every site displayed, which is not really what I want. However, neither do I want to remove the Drush information from `drush status`, so I added an option --site-only, to show only the status information for the selected Drupal site in the status report.

Having that was fine, but what I would really like to do is specify it automatically in mult-site situations. However, a command-specific option in one of the alias files wouldn't do the trick, because that would once again remove the drush information unconditionally.

To allow for more flexibility with context-sensitive options, I added a 'context-prefix' option to Drush. If you set this option to something, e.g. --context-prefix=special, then drush will look for additional configuration files with the specified prefix -- in this case, special-drushrc.php. These files can be stored any place that drushrc.php files are found.

Next, in the command dispatch code for multi-site dispatches, I added --context-prefix=multi. As a final step, I added a multi-drushrc.php file to the Drush root, and set $command_specific['status']['site-only'] = TRUE;

I probably could have (and maybe should have) gotten the feature I wanted for drush status simply by removing the Drush info when there is a bootstrapped Drupal site. I present this option at #1382346: Shorten 'drush status' output when there is a bootstrapped site.

I still think that --context-prefix could be a useful feature; for example, drush make could set --context-prefix=make for all of its callbacks, allowing users to put command-specific pm-* options into make-drushrc.php files. This would allow for concurrency et.al. to be controlled independently for makefiles vs. "ordinary" pm-* usage. I think that other uses for this might pop up if we had it available to us.

If --context-prefix is desired, but the status code included in this patch is not (perhaps in favor of #1382346), then I will separate these into separate issues.

CommentFileSizeAuthor
context-prefix.patch9.05 KBgreg.1.anderson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

IIRC, Mark proposed command specific RC files similar to this. I think he was working on drush deploy at the time. Lets see what he says. At first glance, this sould a bit too complicated for my taste. I'm getting cautious about overcomplicating our codebase.

greg.1.anderson’s picture

I closed #1382346: Shorten 'drush status' output when there is a bootstrapped site as a duplicate. Regarding #1, I think that this feature has more utility than command-specific config files, but it is, perhaps, too much just to solve the problems of core-status. Let's see what others think about its usefulness in for other commands.

msonnabaum’s picture

The solution here is pretty confusing to me, but I'd like to make sure I understand the problem we're trying to solve first.

We want a way to provide command specific options that only apply when the command is being run on more than one alias?

greg.1.anderson’s picture

Re: #3, yes, that is the only use-case I have right now. Hypothetically, this might also be useful in other instances (as mentioned at the end of #0), but I don't have any specific examples of that yet. I'd be open to simpler solutions that accomplished the same goal if anyone had any good ideas about that.

greg.1.anderson’s picture

Can we commit this issue, or close-will-not-fix it?

moshe weitzman’s picture

Status: Needs review » Closed (won't fix)

simplicity++