def info_cmd(load_file, name): logger = logging.getLogger('cibopath') templates = [t for t in load(load_file) if t.name == name] for template in templates: logger.debug('Info for {}'.format(template)) click.echo('Name: {}'.format(template.name)) click.echo('Author: {}'.format(template.author)) click.echo('Repository: {}'.format(template.url)) context = json.dumps(template.context, indent=4, sort_keys=True) click.echo('Context: {}'.format(context))
def search_cmd(load_file, tags): logger = logging.getLogger('cibopath') templates = load(load_file) matches = [] for template in templates: logger.debug('Processing {}'.format(template)) if all(tag.lower() in template for tag in tags): matches.append(template) if not matches: click.echo('No match for "{}"'.format(', '.join(tags))) return message = '{template.name:.<36} {template.url}' for match in sorted(matches): click.echo(message.format(template=match))