INNER CODE UNIT · Python
clean
yifanfeng97/Hyper-Extract · hyperextract/cli/cli.py:1562
def clean(
ka_path: str = typer.Argument(..., help="Knowledge Abstract directory"),
all_: bool = typer.Option(
False,
"--all",
"-a",
help="Remove the ENTIRE Knowledge Abstract (data, metadata, and index)",
),
yes: bool = typer.Option(False, "--yes", "-y", help="Skip the confirmation prompt"),
):
"""Clean a Knowledge Abstract: remove its search index, or the whole KA with --all."""
import shutil
logger.info("command=clean ka_path=%s all=%s", ka_path, all_)
# validate_ka_with_data ensures the target really is a KA (has data.json),
# so --all never rmtree's an arbitrary mistyped directory.
path = validate_ka_with_data(ka_path)