You are here

function node_export_drush_command in Node export 7.3

Same name and namespace in other branches
  1. 8 node_export.drush.inc \node_export_drush_command()
  2. 6.3 node_export.drush.inc \node_export_drush_command()
  3. 6.2 node_export.drush.inc \node_export_drush_command()

Implements hook_drush_command().

1 call to node_export_drush_command()
node_export_drush_help in ./node_export.drush.inc
Implements hook_drush_help().

File

./node_export.drush.inc, line 11
Drush support for node_export.

Code

function node_export_drush_command() {
  $items = array();
  $items['node-export-export'] = array(
    'callback' => 'drupal_node_export_callback_export',
    'description' => "Export nodes using Node export.",
    'arguments' => array(
      'nids' => "A list of space-separated node IDs to export.",
    ),
    'options' => array(
      'file' => "The filename of the output file.  If supplied, the node code will be exported to that file, otherwise it will export to stdout.",
      'format' => "If supplied, node code will be output using a particular export format, if available. (e.g. serialize)",
      'status' => "Filter for 'status'; A boolean value (0 or 1) indicating whether the node is published (visible to non-administrators).",
      'promote' => "Filter for 'promote'; A boolean value (0 or 1) indicating whether the node should be displayed on the front page.",
      'sticky' => "Filter for 'sticky'; A boolean value (0 or 1) indicating whether the node should be displayed at the top of lists in which it appears.",
      'translate' => "Filter for 'translate'; A boolean value (0 or 1) indicating whether the node translation needs to be updated.",
      'language' => "Filter for 'language'; The language code (e.g. de or en-US) of this node.",
      'type' => "Filter for 'type'; The machine-readable name (e.g. story or page) of the type of this node.",
      'sql' => "Filter by SQL (EXPERIMENTAL); An SQL query string that returns nids (e.g. \"SELECT nid FROM nodes WHERE nid < 10\").",
      'code' => "Filter by PHP code (EXPERIMENTAL); PHP code that prints or returns, an array or CSV string of nids (e.g. \"custom_get_my_nids();\"). Don't include PHP tags.",
    ),
    'examples' => array(
      'drush node-export-export 45 46 47 --file=filename' => "export nodes with node IDs 45, 46, and 47 to the file with the supplied filename.",
      'drush node-export-export --type=story,page --file=filename' => "export nodes of type story and page to the file with the supplied filename.",
    ),
  );
  $items['node-export-import'] = array(
    'callback' => 'drush_node_export_callback_import',
    'description' => "Import nodes previously exported with Node export.",
    'options' => array(
      'uid' => "User ID of user to save nodes as. If not given will use the user with an ID of 1. You may specify 0 for the Anonymous user.",
      'file' => "The filename of the input file.  If supplied, the node code will be imported from that file, otherwise it will import to stdin.",
    ),
    'examples' => array(
      'drush node-export-import --file=filename' => 'Import nodes from the file with the given filename.',
      'drush node-export-import --uid=2 --file=filename' => "Import nodes from the file with the given filename.  The author of the nodes will be set to the user that has the user ID of 2.",
    ),
  );

  // Add aliases for usability.
  node_export_drush_command_add_alias($items, 'node-export-export', 'node-export');
  node_export_drush_command_add_alias($items, 'node-export-export', 'ne-export');
  node_export_drush_command_add_alias($items, 'node-export-import', 'ne-import');
  return $items;
}