from pathlib import Path


def get_importfilelist(args):
    """Convert optional list of import files into a consistent list form

    Specifying one or more import files to load at startupis optional.
    
    If the -i/--import switch isn't provided, then None is passed on.
    
    if the -i/--import is specified without a filename, then we will
    place Path("import_--filename.md") as the only item in the list.
    
    Otherwise, the list of files will be passed on as-is.
    """
    if args.importfilelist is not None and len(args.importfilelist) == 0:
        filename = Path(args.filename).resolve()
        return [str(Path().joinpath(filename.parent, f'import_{filename.name}'))]
    
    return args.importfilelist