INNER CODE UNIT · Python
resolve_input_path
KennethJAllen/proper-pixel-art · proper_pixel_art/cli.py:148
def resolve_input_path(
parser: argparse.ArgumentParser, args: argparse.Namespace
) -> argparse.Namespace:
"""Resolve the positional input path against the ``-i``/``--input`` flag,
erroring out when neither is given."""
if args.input_path is None and args.input_path_flag is None:
parser.error("You must provide an input path (positional or with -i).")
args.input_path = (
args.input_path if args.input_path is not None else args.input_path_flag
)
return args
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description=(
"Generate true-resolution pixel art from a source image, video, or GIF. "
"Video and GIF inputs are auto-detected and dispatched to the video pipeline."