Skip to content

Commit

Permalink
CLI setup + improved types for CLI parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-pl committed Mar 18, 2024
1 parent 5c76d66 commit c6e4041
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 13 deletions.
84 changes: 83 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lodkit = "^0.1.13"
requests = "^2.31.0"
loguru = "^0.7.2"
pyyaml = "^6.0.1"
typer = "^0.9.0"
typer = {extras = ["all"], version = "^0.9.0"}


[tool.poetry.group.dev.dependencies]
Expand Down
6 changes: 3 additions & 3 deletions rdfingest/cli_help.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Help strings for the RDFIngest CLI."""
"""Help messages for the RDFIngest CLI."""

config_help = """<Config help>"""
registry_help = """<Registry help>"""
config_help = "<config help>"
registry_help = "<registry help>"
30 changes: 22 additions & 8 deletions rdfingest/main.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
"""Very simple Typer CLI for RDFIngest."""

from pathlib import Path
from typing import Annotated
from typing import Annotated, Union

import typer

from loguru import logger

from rdfingest.cli_help import config_help, registry_help
from rdfingest.rdfingest import RDFIngest
from rdfingest.ingest import RDFIngest


def main(
config: Annotated[
Path | str,
typer.Option(help=config_help)
] = "./config.yaml",
Path,
typer.Option(
help=config_help,
exists=True,
file_okay=True,
dir_okay=False,
readable=True,
resolve_path = True
)
] = Path("./config.yaml"),
registry: Annotated[
Path | str,
typer.Option(help=registry_help)
] = "./registry.yaml"
Path,
typer.Option(
help=registry_help,
exists=True,
file_okay=True,
dir_okay=False,
readable=True,
resolve_path = True
)
] = Path("./registry.yaml")
):
"""RDFIngest CLI."""
logger.info("Initializing RDFIngest.")
Expand Down

0 comments on commit c6e4041

Please sign in to comment.