function drush_shift

8.0.x command.inc drush_shift()
6.x command.inc drush_shift()
7.x command.inc drush_shift()
4.x command.inc drush_shift()
5.x command.inc drush_shift()
master command.inc drush_shift()

Pop an argument off of drush's argument list

File

includes/command.inc, line 864
The drush command engine.

Code

function drush_shift() {
  $arguments = drush_get_arguments();
  $result = NULL;
  if (!empty($arguments)) {
    // The php-script command uses the DRUSH_SHIFT_SKIP
    // context to cause drush_shift to skip the 'php-script'
    // command and the script path argument when it is
    // called from the user script.
    $skip_count = drush_get_context('DRUSH_SHIFT_SKIP');
    if (is_numeric($skip_count)) {
      for ($i = 0; $i < $skip_count; $i++) {
        array_shift($arguments);
      }
      $skip_count = drush_set_context('DRUSH_SHIFT_SKIP', 0);
    }
    $result = array_shift($arguments);
    drush_set_arguments($arguments);
  }
  return $result;
}