use case :
drush dl views
Project views contains 3 modules: views_export, views_ui, views.
paste and copy :
drush en views_export, views_ui, views
results in errors ... views_ui, was not found and will not be enabled.
i love the way the modules are shown, but it would help a lot to be able to copy the list directly, wouldnt it ?
thanks :)

Comments

jonhattan’s picture

Assigned: Unassigned » jonhattan
Status: Active » Needs review
StatusFileSize
new1.89 KB

I had a proposal for the opposite: allow commas in drush pm-enable, etc.

Note: it allow commas in addition to spaces.

greg.1.anderson’s picture

Status: Needs review » Needs work

#1 is good, but perhaps it should be something along the lines of this (untested):

function _pm_clean_projects_list($args) {
  $projects = explode(',', implode(',',$args));
  // remove empty items from $projects
  return $projects;
}

Might need to remove empty items from the result. The basic idea is that your $args might be a single item with commas in it, such as "a,b,c", or it might be three different items with commas at the end, such as "a," "b," "c,", so we first merge the array together by ','. The first case is unchanged, but the second case gives you "a,,b,,c,". When we explode the result, we get a list with "a", "b" and "c" in it; in the second case we also have some empty elements. Remove those, and the list should be clean.

greg.1.anderson’s picture

Status: Needs work » Needs review
StatusFileSize
new2.77 KB

Here is a patch with my suggestion from #2. I broke the utility function out into drush.inc, as it might be useful in other circumstances.

jonhattan’s picture

Awesome. While reviewing to update some help strings I hit _drush_pm_expand_projects() perhaps we can hook _convert_csv_to_array() there.

greg.1.anderson’s picture

StatusFileSize
new4.82 KB

_drush_pm_expand_projects() is not an appropriate place to call _convert_csv_to_array because the args to _drush_pm_expand_projects have already been passed through _convert_csv_to_array.

Here's a patch with more consistent use of _convert_csv_to_array throughout the pm_* commands. I also considered other places in drush where it might be used, but rejected them all. The "field" commands expect some of its args to have commas, so it would break things to expand there. Variable set takes a key and a value, so it's not a good candidate. Variable get -could- use it, but I did not for consistency with variable set. Core status isn't good, because its args can contain spaces, and that seemed too confusing. Help could use _convert_csv_to_array, but I skipped this one because it is not used anywhere else in core.

jonhattan’s picture

Status: Needs review » Fixed

Ok. Commited #5 along with some changes to help strings.

http://drupal.org/cvs?commit=453950

greg.1.anderson’s picture

Looks like you only committed your help text changes, so I committed #5.

http://drupal.org/cvs?commit=453984

jonhattan’s picture

Whoops. I did work on other directory. Definitely need git for local branches !

mojzis’s picture

Status: Fixed » Closed (fixed)

thanks :) it works nice now