skyeweave/atlasimagecomposer/cli.py
Firq 7dc30b95cf
Some checks failed
/ pylint (push) Successful in 14s
/ mypy (push) Failing after 15s
Initial commit
2024-08-09 18:57:33 +02:00

42 lines
1.2 KiB
Python

import argparse
import pathlib
import sys
from . import __version__
# pylint: disable=too-few-public-methods
class Arguments(argparse.Namespace):
"""
Default Arguments when calling the CLI
"""
output: str
def parse_arguments():
"""
Create a parser and parse the arguments of sys.argv based on the Arguments Namespace
Returns arguments and extra arguments separately
"""
parser = argparse.ArgumentParser(
prog="atlasimagecomposer",
description="CLI tool to automatically generate expression sheets for servants",)
parser.add_argument("--output", action="store", type=str, default=None, dest="output", help="Set the output location. This can be an absolute or relative path")
parser.add_argument("--version", action="version", version=f"atlasimagecomposer {__version__}")
args = Arguments()
args, extra_args = parser.parse_known_args(sys.argv[1:], namespace=args)
return args, extra_args
class Paths:
_root = pathlib.Path(__file__).parent
_args, _ = parse_arguments()
IMAGES = _root / ".temp"
OUTPUT = _root / ".out"
if _args.output:
OUTPUT = pathlib.Path(_args.output)
class Expressions:
height = 256
width = 256