tripal_pub.drush.inc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @file
  4. * Contains function relating to drush-integration of this module.
  5. */
  6. /**
  7. * Describes each drush command implemented by the module
  8. *
  9. * @return
  10. * The first line of description when executing the help for a given command
  11. */
  12. function tripal_pub_drush_help($command) {
  13. switch ($command) {
  14. case 'drush:tripal-pub-import':
  15. return dt('Imports publications from remote databases using saved configuration settings.');
  16. }
  17. }
  18. /**
  19. * Registers a drush command and constructs the full help for that command
  20. *
  21. * @return
  22. * And array of command descriptions
  23. */
  24. function tripal_pub_drush_command() {
  25. $items = array();
  26. $items['tripal-pubs-import'] = array(
  27. 'description' => dt('Imports publications from remote databases using saved configuration settings.'),
  28. 'examples' => array(
  29. 'Standard example' => 'drush tripal-pubs-import',
  30. ),
  31. 'aliases' => array('tpubs-import'),
  32. );
  33. $items['tripal-pubs-update'] = array(
  34. 'description' => dt('Updates publication information for publications with a supported database cross-reference.'),
  35. 'options' => array(
  36. 'create_contacts' => dt('provide this option to create or update contacts for authors. By default contacts are not created or updated.'),
  37. 'dbxref' => dt('An accession number for a publication from a remote database (e.g. PMID:23582642)')
  38. ),
  39. 'examples' => array(
  40. 'Standard example' => 'drush tripal-pubs-update',
  41. 'Create contacts during update' => 'drush tripal-pubs-update --create_contacts=1',
  42. 'Update a single record' => 'drush tripal-pubs-update --dbxref=PMID:23582642'
  43. ),
  44. 'aliases' => array('tpubs-update'),
  45. );
  46. return $items;
  47. }
  48. /**
  49. * Imports publications into Chado
  50. *
  51. */
  52. function drush_tripal_pub_tripal_pubs_import() {
  53. tripal_pub_import_publications();
  54. }
  55. /**
  56. * Imports publications into Chado
  57. *
  58. */
  59. function drush_tripal_pub_tripal_pubs_update() {
  60. $create_contacts = drush_get_option('create_contacts');
  61. $dbxref = drush_get_option('dbxref');
  62. tripal_pub_update_publications($create_contacts, $dbxref);
  63. }