How to use the milc.cli.args.yes function in milc

To help you get started, we’ve selected a few milc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qmk / qmk_firmware / lib / python / qmk / questions.py View on Github external
default
            Whether to default to a Yes or No when the user presses enter.

            None- force the user to enter Y or N

            True- Default to yes

            False- Default to no
    """
    if not args and kwargs:
        args = kwargs

    if 'no' in cli.args and cli.args.no:
        return False

    if 'yes' in cli.args and cli.args.yes:
        return True

    if default is not None:
        if default:
            prompt = prompt + ' [Y/n] '
        else:
            prompt = prompt + ' [y/N] '

    while True:
        print()
        answer = input(format_ansi(prompt % args))
        print()

        if not answer and prompt is not None:
            return default