2024-08-09 16:57:33 +00:00
import argparse
import pathlib
import sys
2024-10-04 18:18:56 +00:00
from . . import __version__
from . . backend import compose
from . . config import Paths
2024-08-09 16:57:33 +00:00
# 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
2024-10-04 18:18:56 +00:00
def welcome ( ) :
print ( " ------------------------------------------------- " )
print ( " Welcome to the FGO Sprite loader and composer " )
print ( " developed by Firq " )
print ( " ------------------------------------------------- " )
2024-08-09 16:57:33 +00:00
2024-10-04 18:18:56 +00:00
def run ( ) :
args , _ = parse_arguments ( )
if args . output :
Paths . OUTPUT = pathlib . Path ( args . output )
welcome ( )
compose ( )