#!/usr/bin/env python3
from argparse import ArgumentParser

from ascii_py import ascii_py  # type: ignore


def main():
    parser = ArgumentParser()
    parser.add_argument("input_file", help="Input file to convert from.")
    parser.add_argument(
        "-o",
        "--out",
        default="out.jpg",
        help="The filename you want your final image saved as.",
    )
    parser.add_argument(
        "-w",
        "--words",
        default="#",
        help="Use words to create your image.",
    )
    parser.add_argument(
        "-s",
        "--step",
        type=int,
        default=3,
        help="Choose the distance of your characters.",
    )
    parser.add_argument(
        "-d",
        "--density",
        action="store_true",
        help="Adding the flag converts the image based on visual density.",
    )
    parser.add_argument(
        "-t",
        "--terminal",
        action="store_true",
        help="Print ascii image to terminal.",
    )

    args = parser.parse_args()

    a = ascii_py.Ascii(args.input_file)

    if args.density:
        a.density_artify(step=args.step)
        a.save(args.out)

    elif args.terminal:
        a.terminal_artify()

    else:
        a.word_artify(args.words, args.step)
        a.save(args.out)


if __name__ == "__main__":
    main()
