def save_to_single_file()

in psaw/psaw.py [0:0]


def save_to_single_file(things, output_file, writer, count,
                        verbose=False, dry_run=False):
    """
    Write all things to a single file

    :param things: iterable
    :param output_file: str
    :param writer: Writer
    :param count: int
    :param verbose: bool
    :param dry_run: bool

    """
    count = 0
    writer.open(output_file)
    writer.header()
    try:
        with click.progressbar(things, length=count) as things:
            for thing in things:
                if not dry_run:
                    writer.write(thing.d_)
                    count += 1
    finally:
        writer.footer()
        writer.close()

    if verbose:
        click.echo("wrote {} items to {}".format(count, output_file))