Skip to content

Commit

Permalink
Feat(cli): Add cli module
Browse files Browse the repository at this point in the history
  • Loading branch information
leoank committed Jun 18, 2024
1 parent 64d9c83 commit b85709c
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions starrynight/src/starrynight/cli/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Starrynight console."""

from pathlib import Path

import click

from starrynight.inventory import create_inventory_local
from starrynight.index import gen_pcp_index


@click.command(name="local")
@click.option("-d", "--dataset", required=True)
@click.option("-o", "--out", required=True)
@click.option("-p", "--prefix", type=click.STRING)
def inv_local(dataset: str, out: str, prefix: str) -> None:
if prefix is None:
prefix = str(Path(dataset).resolve())
create_inventory_local(Path(dataset), Path(out), prefix)


@click.group()
def inventory() -> None:
pass


inventory.add_command(inv_local)


@click.command(name="local")
@click.option("-d", "--dataset", required=True)
@click.option("-o", "--out", required=True)
@click.option("-p", "--prefix", type=click.STRING)
def index_local(dataset: str, out: str, prefix: str) -> None:
if prefix is None:
prefix = str(Path(dataset).resolve())
create_inventory_local(Path(dataset), Path(out), prefix)
gen_pcp_index(Path(out).joinpath("inventory.parquet"), Path(out))


@click.group()
def index() -> None:
pass


index.add_command(index_local)


@click.group
def main() -> None:
pass


main.add_command(inventory)
main.add_command(index)

0 comments on commit b85709c

Please sign in to comment.