<commit_before>import ruamel.yaml
import re
from argparse import ArgumentParser
from dodo_commands.framework import Dodo


def _args():
    parser = ArgumentParser(description="Print the full configuration.")
    parser.add_argument('--key')
    args = Dodo.parse_args(parser)
    return args


if Dodo.is_main(__name__):
    args = _args()
    if args.key:
        print("%s" % str(Dodo.get_config(args.key, '')))
    else:
        content = re.sub(
            r'^([0-9_A-Z]+\:)$',
            r'\n\1',
            ruamel.yaml.round_trip_dump(Dodo.config),
            flags=re.MULTILINE
        )
        print(
            re.sub(
                r'^\n\n',
                r'\n',
                content,
                flags=re.MULTILINE
            )<commit_msg>Improve print-config when key argument is used<commit_after>import ruamel.yaml
import re
from argparse import ArgumentParser
from dodo_commands.framework import Dodo
from dodo_commands.framework.config import look_up_key


def _args():
    parser = ArgumentParser(description="Print the full configuration.")
    parser.add_argument('key', nargs='?')
    args = Dodo.parse_args(parser)
    if args.key and args.key.startswith('/'):
        args.key = args.key[1:]
    return args


if Dodo.is_main(__name__):
    args = _args()
    if args.key:
        print("%s" % ruamel.yaml.round_trip_dump(
            look_up_key(Dodo.config, args.key, '')
        ))
    else:
        content = re.sub(
            r'^([0-9_A-Z]+\:)$',
            r'\n\1',
            ruamel.yaml.round_trip_dump(Dodo.config),
            flags=re.MULTILINE
        )
        print(
            re.sub(
                r'^\n\n',
                r'\n',
                content,
                flags=re.MULTILINE
            )
{'fraction_non_alphanumeric': 0.1255656108597285, 'fraction_numerical': 0.003959276018099547, 'mean_word_length': 1.8578352180936994, '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': '3430427', 'n_tokens_mistral': 581, 'n_tokens_neox': 551, 'n_words': 109}