Repository: psf/black
File: src/black/__init__.py (Python)

Code before:
        magic_trailing_comma=not skip_magic_trailing_comma,
        experimental_string_processing=experimental_string_processing,
    )
    if config and verbose:
        out(f"Using configuration from {config}.", bold=False, fg="blue")
    if code is not None:
        then = datetime.utcnow()

        try:
            formatted = format_file_contents(code, fast=fast, mode=mode)
        except NothingChanged:
            formatted = code

        if write_back is WriteBack.CHECK:
            ctx.exit(0 if code == formatted else 1)
        elif write_back in (WriteBack.DIFF, WriteBack.COLOR_DIFF):
            now = datetime.utcnow()
            src_name = f"STDIN\t{then} +0000"
            dst_name = f"STDOUT\t{now} +0000"

            diff_contents = output.diff(code, formatted, src_name, dst_name)
            if write_back == WriteBack.COLOR_DIFF:
                diff_contents = color_diff(diff_contents)
            print(diff_contents)
        else:
            print(formatted)

        ctx.exit(0)

    report = Report(check=check, diff=diff, quiet=quiet, verbose=verbose)
    sources = get_sources(
        ctx=ctx,
        src=src,
        quiet=quiet,
        verbose=verbose,
        include=include,
        exclude=exclude,
        extend_exclude=extend_exclude,
        force_exclude=force_exclude,
        report=report,
        stdin_filename=stdin_filename,
    )

    path_empty(
        sources,
        "No Python files are present to be formatted. Nothing to do 😴",
        quiet,
        verbose,
        ctx,
    )


Review comment (suggestion):
Are you sure `--color` works on windows? I would've assumed `wrap_stream_for_windows` would be necessary here. 

Example:

https://github.com/psf/black/blob/754eecf69eed0bdc75fe224c19a702a4f0676807/src/black/__init__.py#L698-L716

Code after:
        experimental_string_processing=experimental_string_processing,
    )
    if config and verbose:
        out(f"Using configuration from {config}.", bold=False, fg="blue")

    if code is not None:
        # Run in quiet mode by default with -c; the extra output isn't useful.
        # You can still pass -v to get verbose output.
        quiet = True

    report = Report(check=check, diff=diff, quiet=quiet, verbose=verbose)

    if code is not None:
        reformat_code(
            content=code, fast=fast, write_back=write_back, mode=mode, report=report
        )
    else:
        sources = get_sources(
            ctx=ctx,
            src=src,
            quiet=quiet,
            verbose=verbose,
            include=include,
            exclude=exclude,
            extend_exclude=extend_exclude,
            force_exclude=force_exclude,
            report=report,
            stdin_filename=stdin_filename,
        )

        path_empty(
            sources,
            "No Python files are present to be formatted. Nothing to do 😴",
            quiet,
            verbose,
            ctx,
        )

        if len(sources) == 1:
            reformat_one(
                src=sources.pop(),
                fast=fast,
                write_back=write_back,
                mode=mode,
                report=report,
            )
        else:
            reformat_many(
                sources=sources,
                fast=fast,
                write_back=write_back,