def METHOD_NAME(
    process_command: click.Command, stream: t.TextIO, name: str
) -> None:
    """
    Use shlex to process stdin line-by-line.
    Also prints help text.
    Requires that @process_command be a Click command object, used for
    processing single lines of input. helptext is prepended to the standard
    message printed to interactive sessions.
    """
    import shlex
    # use readlines() rather than implicit file read line looping to force
    # python to properly capture EOF (otherwise, EOF acts as a flush and
    # things get weird)
    for lineno, line in enumerate(stream.readlines()):
        # get the argument vector:
        # do a shlex split to handle quoted paths with spaces in them
        # also lets us have comments with #
        argv = shlex.split(line, comments=True)
        if argv:
            try:
                with process_command.make_context(f"<process {name}>", argv) as ctx:
                    process_command.invoke(ctx)
            except click.ClickException as error:
                click.echo(
                    f"error encountered processing '{name}' in "
                    f"{stream.name} at line {lineno}:",
                    err=True,
                )
                click.echo(
                    click.style(f"  {error.format_message()}", fg="yellow"), err=True
                )
                click.get_current_context().exit(2)