You are here

function taxonomy_csv_drush_command in Taxonomy CSV import/export 7.5

Same name and namespace in other branches
  1. 6.5 taxonomy_csv.drush.inc \taxonomy_csv_drush_command()

Implements hook_drush_command().

File

./taxonomy_csv.drush.inc, line 11
Drush commands for taxonomy CSV import/export.

Code

function taxonomy_csv_drush_command() {
  $items = array();
  $items['taxocsv-import'] = array(
    'aliases' => array(
      'vocimp',
    ),
    'callback' => 'drush_taxonomy_csv_import',
    'description' => 'Import taxonomies and hierarchical structures with CSV file.',
    'examples' => array(
      'drush taxocsv-import my_file flat' => 'Import my_file using the default settings.',
      'drush taxocsv-import my_file tree --keep_order --delimiter=";" --check_line --vocabulary_target=existing --vocabulary_id=3 --update_or_ignore=update --result_terms' => 'Import my_file as a tree structure into vocabulary with vid 2, a semicolon for delimiter and default settings for other options, and display imported terms after process.',
    ),
    'arguments' => array(
      'file_path' => 'Required. The full path or url to CSV file to import',
      'import_format' => "Optional. CSV format: 'flat' (default), 'tree', 'polyhierarchy', 'fields', 'translate', 'tid_flat', 'tid_tree', 'tid_polyhierarchy'",
    ),
    'options' => array(
      'fields_format' => "List of comma separated fields (default: 'name')",
      'translate_by' => "First item ('name' or 'tid') of a translation import (default: 'name')",
      'translate_languages' => "List of comma separated languages of terms (default: '')",
      'keep_order' => 'Keep order of imported terms',
      'delimiter' => 'CSV delimiter (default: ",")',
      'enclosure' => "CSV enclosure (default: none or '\"')",
      'filter_format' => 'Default format of the description (default: "plain_text")',
      'filter_format_custom' => 'Default format of custom fields (default: "none", as fixed plain text)',
      'language' => 'Default language of terms (default: "und" (undefined))',
      'check_line' => 'Check format of lines',
      'check_utf8' => 'Check utf8 format',
      'locale_custom' => 'Specific locale of imported file',
      'vocabulary_target' => "'autocreate' (default) or 'existing' (default if a vocabulary_id is set)",
      'vocabulary_id' => 'vid or machine_name of the vocabulary to import into',
      'i18n_mode' => 'Internationalization mode of autocreated voc (default: 0 (none))',
      'vocabulary_language' => 'Language of autocreated voc (default: "und" (undefined))',
      'fields_custom' => 'Custom comma separated fields to add or create',
      'delete_terms' => 'Delete all terms before import',
      'check_hierarchy' => 'Check vocabulary hierarchy',
      'set_hierarchy' => "If hierarchy isn't checked, set it (0, 1 or 2 (default))",
      'update_or_ignore' => "What to do with existing items: 'update' (default) or 'ignore'",
      // Level of result process infos.
      'result_stats' => 'Display import stats',
      'result_terms' => 'Display list of imported terms',
      'result_level' => "Level of displayed messages: 'first' (default), 'warnings', 'notices' or 'infos'",
      'result_type' => "Group infos 'by_message' (default) or 'by_line'",
    ),
  );
  $items['taxocsv-export'] = array(
    'aliases' => array(
      'vocexp',
    ),
    'callback' => 'drush_taxonomy_csv_export',
    'description' => 'Export terms and properties to a CSV file.',
    'examples' => array(
      'drush taxocsv-export 2 flat' => "Export all terms names of the vocabulary with vid 2, using the default settings.",
      'drush taxocsv-export 2 tree --delimiter=";" --order=name' => 'Export vocabulary with vid 2 as a CSV tree structure ordered by name, with a semicolon for delimiter, and default settings for other options.',
    ),
    'arguments' => array(
      'vocabulary_id' => 'Required. vid or machine_name of the vocabulary to export (0 means all)',
      'export_format' => "Optional. CSV format: 'flat' (default), 'flat_tid', 'tid_flat', 'tree', 'tid_tree', 'fields', 'tree_fields', 'translate'",
      'file_path' => "Optional. Full path or filename of exported csv file (default: [current directory]/taxocsv.csv)",
    ),
    'options' => array(
      'fields_format' => "List of comma separated fields (default: 'name')",
      'delimiter' => 'One character csv delimiter (default: ",")',
      'enclosure' => "Zero or one character csv enclosure (default: '\"')",
      'line_ending' => "'Unix' (default), 'Mac' or 'MS-DOS'",
      'order' => "Order of terms: 'name' (default), 'tid' or 'weight'",
      // Level of result process infos.
      'result_duplicates' => "Display duplicate terms",
    ),
  );
  return $items;
}