Drush API for downloading module from a script I am trying to download module using Drush API via drush script as following:

#!/usr/bin/env drush
&lt;?php

// check if we can bootstrap
$self = drush_sitealias_get_record('@self');
if (empty($self)) {
    drush_die("I can't bootstrap from the current location.", 0);
}

// goes to site directory
drush_op('chdir', $self['root']);


drush_include_engine('drupal', 'environment', drush_drupal_major_version());

//****how to download module

drush_module_enable(array('uuid'));

drush_print("Done.");


While i see an Drush API for enabling, i don't see for downloading a module
How to download a module via Drush API from the script? Is there Drush API for automatically detect dependencies, download them and enable? Thank You

Drupal 7, Drush 5.8, Mac
If there's an API for this, I think it would be drush_invoke_process. I believe Drush uses that function internally when one command wants to execute another.

The primary function that executes the download work is drush_pm_download(), so you could probably just call it directly as well.

And of course, as a last resort, you could use exec(drush @alias dl $module).