Skip to content

Commit

Permalink
Merge pull request #43 from gregcaporaso/issue-40
Browse files Browse the repository at this point in the history
ENH: support discovery of plugin citations and user support text
  • Loading branch information
ebolyen committed Aug 8, 2016
2 parents 46909ea + 55a3539 commit 21ba109
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
17 changes: 11 additions & 6 deletions q2cli/_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ def _echo_plugins():
# https://github.com/qiime2/qiime2/issues/82
click.secho('No plugins are currently installed.\nYou can browse '
'the official QIIME 2 plugins at: '
'https://github.com/qiime2')
'http://2.qiime.org/Plugins')
else:
for name, plugin in installed_plugins.items():
click.echo('%s %s (%s)' %
(name, plugin.version, plugin.website))
click.echo('%s %s' % (name, plugin.version))


def _echo_installed_packages():
Expand All @@ -62,6 +61,12 @@ def info(py_packages):
if py_packages:
click.secho('\nInstalled Python packages', fg='green')
_echo_installed_packages()
click.secho('\nTo get help with QIIME, visit %s.' % qiime.sdk.HELP_URL)
click.secho('If you use QIIME in any published work, please cite %s' %
qiime.sdk.CITATION)

click.secho('\nGetting help', fg='green')
click.secho('To get help with QIIME 2, visit %s.' % qiime.sdk.HELP_URL)

click.secho('\nCiting QIIME 2', fg='green')
click.secho('If you use QIIME 2 in any published work, you should cite '
'QIIME 2 and the plugins that you used. To find the relevant '
'citations, run:')
click.secho('\tqiime tools citations')
16 changes: 16 additions & 0 deletions q2cli/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,19 @@ def extract(path, output_dir):
raise click.BadParameter(
'%s is not a QIIME Result. Only QIIME Visualizations and Artifacts'
' can be extracted.' % path)


@tools.command(help='Present citations for QIIME and installed plugins.')
def citations():
click.secho('If you use QIIME 2 in any published work, you should cite '
'QIIME 2 and the plugins that you used. The citations for '
'QIIME and all installed plugins follow.')
click.secho('\nQIIME 2 framework and command line interface', fg='green')
click.secho('Pending a QIIME 2 publication, please cite QIIME using the '
'original publication: %s' % qiime.sdk.CITATION)

plugin_manager = qiime.sdk.PluginManager()
installed_plugins = plugin_manager.plugins
for name, plugin in sorted(installed_plugins.items()):
click.secho('\n%s' % name, fg='green')
click.secho(plugin.citation_text)
10 changes: 7 additions & 3 deletions q2cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ def get_command(self, ctx, name):
else:
return _build_visualizer_command(
name, plugin.visualizers[action_name])
# TODO: pass help=plugin.description, pending its existence:
# https://github.com/qiime2/qiime2/issues/81
return PluginCommand(ctx)
# TODO: pass short_help=plugin.description, pending its
# existence: https://github.com/qiime2/qiime2/issues/81
_support = 'Getting user support: %s' % plugin.user_support_text
_citing = 'Citing this plugin: %s' % plugin.citation_text
_website = 'Plugin website: %s' % plugin.website
_help = '\n\n'.join([_website, _support, _citing])
return PluginCommand(ctx, short_help='', help=_help)
else:
return None

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
license='BSD-3-Clause',
packages=find_packages(),
include_package_data=True,
install_requires=['click', 'qiime >= 2.0.0', 'pip'],
install_requires=['click', 'qiime >= 2.0.2', 'pip'],
entry_points='''
[console_scripts]
qiime=q2cli.cli:main
Expand Down

0 comments on commit 21ba109

Please sign in to comment.