Shell alias replacements can support arbitrary items via the {{sitealias-item}} pattern. I run into a problem when I try to set a site_name item for the purposes of a shell alias replacement (I want to update various variable settings on a dev site after syncing it with the production DB): if I try to do something like !drush {{@target}} vset site_name {{site_name}} where the site_name in the alias is something like "Example Site Dev", the site_name will successfully get set to "Example". The shell alias grabs values and splits on the spaces to set up the command arguments, which means values with spaces get split into arguments.

Comments

greg.1.anderson’s picture

Does !drush {{@target}} vset site_name "{{site_name}}" work for you?

hackwater’s picture

No, because the quoted string still has spaces. When it hits line 1764 in includes/command.inc, it splits the string, so in this case it would get set to "Example. Via an ugly hack, I can force it to preserve the string through the explode
?>, but it's not really a feasible solution: I perform a rawurlencode on the values coming in from line 1745 if they contain a space. After the explode on line 1764, I go through the array and look for a %20 string in its values, and convert it.
Like I said: ugly.

greg.1.anderson’s picture

Yeah, that's a problem. To fix this, we'd need a replacement for php's explode function that will respect quoted character sequences. Patches welcome.

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.