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

Function db_check_cmd

explainshell/manager.py:1253–1273  ·  view source on GitHub ↗

Run database integrity checks.

(ctx: click.Context)

Source from the content-addressed store, hash-verified

1251@cli.command("db-check")
1252@click.pass_context
1253def db_check_cmd(ctx: click.Context) -> None:
1254 """Run database integrity checks."""
1255 from explainshell.db_check import check as run_db_check
1256
1257 issues = run_db_check(_require_db(ctx, must_exist=True))
1258 if not issues:
1259 click.echo("No issues found.")
1260 return
1261
1262 n_errors = sum(1 for sev, _ in issues if sev == "error")
1263 n_warnings = sum(1 for sev, _ in issues if sev == "warning")
1264 for severity, msg in issues:
1265 label = (
1266 f"{_DB_CHECK_RED}ERROR{_DB_CHECK_RESET}"
1267 if severity == "error"
1268 else f"{_DB_CHECK_CYAN}WARNING{_DB_CHECK_RESET}"
1269 )
1270 click.echo(f" {label}: {msg}")
1271 click.echo(f"\n{n_errors} error(s), {n_warnings} warning(s)")
1272 if n_errors:
1273 sys.exit(1)
1274
1275
1276if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

_require_dbFunction · 0.85

Tested by

no test coverage detected