MCPcopy Index your code
hub / github.com/idank/explainshell / diff_db_cmd

Function diff_db_cmd

explainshell/manager.py:932–974  ·  view source on GitHub ↗

Diff fresh extraction against the database.

(
    ctx: click.Context,
    mode: str,
    files: tuple[str, ...],
    batch: int | None,
    debug: bool,
)

Source from the content-addressed store, hash-verified

930@click.argument("files", nargs=-1, required=True)
931@click.pass_context
932def diff_db_cmd(
933 ctx: click.Context,
934 mode: str,
935 files: tuple[str, ...],
936 batch: int | None,
937 debug: bool,
938) -> None:
939 """Diff fresh extraction against the database."""
940 try:
941 parsed_mode, model = _parse_mode(mode)
942 except ValueError as e:
943 raise click.UsageError(str(e))
944
945 if batch is not None:
946 if batch < 1:
947 raise click.UsageError("--batch must be >= 1")
948 if not model:
949 raise click.UsageError(
950 "--batch requires a model (e.g. llm:gemini/<model>, llm:openai/<model>, or llm:azure/<deployment>)"
951 )
952 if not model.startswith(_BATCH_MODEL_PREFIXES):
953 raise click.UsageError(
954 "--batch only supports gemini/, openai/, and azure/ models"
955 )
956
957 db_path = _require_db(ctx)
958 try:
959 gz_files = util.collect_gz_files(list(files))
960 except ValueError as e:
961 raise click.UsageError(str(e))
962 if not gz_files:
963 raise click.UsageError("No .gz files found.")
964
965 run_dir: str = _ensure_run_dir(ctx)
966 s = store.Store.create(db_path)
967 t0 = time.monotonic()
968 batch_result = _run_diff_db(
969 gz_files, parsed_mode, model, run_dir, debug, s, batch_size=batch
970 )
971 elapsed = time.monotonic() - t0
972 rc = _log_summary(batch_result, 0, elapsed)
973 if rc != 0:
974 sys.exit(rc)
975
976
977@diff.command("extractors")

Callers

nothing calls this directly

Calls 6

_parse_modeFunction · 0.85
_require_dbFunction · 0.85
_ensure_run_dirFunction · 0.85
_run_diff_dbFunction · 0.85
_log_summaryFunction · 0.85
createMethod · 0.45

Tested by

no test coverage detected