Verified Commit 6cd9c17d authored by Jakob Moser's avatar Jakob Moser
Browse files

Add FileFormat parameter

parent e4c7c3b5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
from enum import StrEnum, auto


class FileFormat(StrEnum):
    HTML = auto()
    PDF = auto()
+15 −1
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@ from typing import Annotated

import typer

from coliverter.FileFormat import FileFormat

app = typer.Typer()


@@ -20,9 +22,21 @@ def main(
            help="Path to the output file. If None, write output to STDOUT."
        ),
    ] = None,
    file_format: Annotated[
        FileFormat | None,
        typer.Option(
            help="Format of the output file. If None, infer from extension in output path. If inferring is not possible, default to html."
        ),
    ] = None,
) -> None:
    """
    Convert Markdown files into other formats, using the organization identity of Fachschaft Computerlinguistik.
    """
    if file_format is None:
        try:
            file_format = FileFormat[output_path.suffix if output_path else None]
        except KeyError:
            file_format = FileFormat.HTML

    # TODO Implement this
    print(markdown_path, output_path)
    print(markdown_path, output_path, file_format)