Mercurial > repos > shellac > sam_consensus_v3
diff env/lib/python3.9/site-packages/planemo/commands/cmd_create_alias.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/env/lib/python3.9/site-packages/planemo/commands/cmd_create_alias.py Mon Mar 22 18:12:50 2021 +0000 @@ -0,0 +1,37 @@ +"""Module describing the planemo ``create_alias`` command.""" +import click + +from planemo import options +from planemo.cli import command_function +from planemo.galaxy import profiles +from planemo.io import info + +try: + import namesgenerator +except ImportError: + namesgenerator = None + + +@click.command('create_alias') +@click.argument( + "obj", + metavar="OBJ", + type=click.STRING, +) +@options.alias_option() +@options.profile_option(required=True) +@command_function +def cli(ctx, alias, obj, profile, **kwds): + """ + Add an alias for a path or a workflow or dataset ID. Aliases are associated with a particular planemo profile. + """ + if not alias: + if not namesgenerator: + raise ImportError(("Random generation of aliases requires installation of the namesgenerator package." + "Either install this, or specify the alias name with --alias.")) + alias = namesgenerator.get_random_name() + + exit_code = profiles.create_alias(ctx, alias, obj, profile) + info("Alias {} created.".format(alias)) + ctx.exit(exit_code) + return