<commit_before>import click
from os import listdir, makedirs
from os.path import isdir, join, exists
from click import ClickException


def create_at_path(path):
    if exists(path):
        raise ClickException("Role %s already exists" % path)

    # Create the directory layout
    makedirs(join(path, 'defaults'))
    makedirs(join(path, 'files'))
    makedirs(join(path, 'meta'))
    makedirs(join(path, 'tasks'))
    makedirs(join(path, 'templates'))

    # Create the empty main.yml files
    open(join(path, 'defaults', 'main.yml'), 'a').close()
    open(join(path, 'meta', 'main.yml'), 'a').close()
    open(join(path, 'tasks', 'main.yml'), 'a').close()


@click.command()
@click.argument('name')
def create_role(name):
    """ A simple tool that creates an ansible role with the
        reccomended directory layout """
    roles_dir = [member for member in listdir('.')
                 if isdir(member) and member == 'roles']

    if roles_dir:
        create_at_path(join(".", "roles", name))
    else:
        create_at_path(join(".", name))


if __name__ == '__main__':
    create_role()<commit_msg>Roler now outputs results<commit_after>import click
from os import listdir, makedirs
from os.path import isdir, join, exists, abspath
from click import ClickException


def create_at_path(path):
    if exists(path):
        raise ClickException("Role %s already exists" % path)

    # Create the directory layout
    makedirs(join(path, 'defaults'))
    makedirs(join(path, 'files'))
    makedirs(join(path, 'meta'))
    makedirs(join(path, 'tasks'))
    makedirs(join(path, 'templates'))

    # Create the empty main.yml files
    open(join(path, 'defaults', 'main.yml'), 'a').close()
    open(join(path, 'meta', 'main.yml'), 'a').close()
    open(join(path, 'tasks', 'main.yml'), 'a').close()

    # Output created role path
    print("Created role: %s" % abspath(path))


@click.command()
@click.argument('name')
def create_role(name):
    """ A simple tool that creates an ansible role with the
        reccomended directory layout """
    roles_dir = [member for member in listdir('.')
                 if isdir(member) and member == 'roles']

    if roles_dir:
        create_at_path(join(".", "roles", name))
    else:
        create_at_path(join(".", name))


if __name__ == '__main__':
    create_role()
{'fraction_non_alphanumeric': 0.15010752688172044, 'fraction_numerical': 0.0, 'mean_word_length': 3.615079365079365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4449763', 'n_tokens_mistral': 756, 'n_tokens_neox': 738, 'n_words': 207}