You are here

function drush_node_export_export in Node export 8

Drush command logic for command node_export_export.

1 string reference to 'drush_node_export_export'
node_export_drush_command in ./node_export.drush.inc
Implements hook_drush_command().

File

./node_export.drush.inc, line 88
Drush integration for Node Export module.

Code

function drush_node_export_export() {
  $ids = array_filter(func_get_args(), 'is_numeric');
  $save = substr(strtolower(drush_get_option('file')), 0, 1) === 'y';
  $export = NodeExport::export($ids, 'json', $save);
  if ($save) {
    if ($export) {
      drush_print(dt('Nodes exported to ' . \Drupal::service('file_system')
        ->realpath($export
        ->getFileUri())));
    }
    else {
      drush_set_error('Could not export the nodes.');
    }
  }
  else {
    drush_print_r($export);
  }
}