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

Function _require_db

explainshell/manager.py:502–512  ·  view source on GitHub ↗

Return the --db path or raise a UsageError if not set. When *must_exist* is True, also verify the file is present on disk.

(ctx: click.Context, *, must_exist: bool = False)

Source from the content-addressed store, hash-verified

500
501
502def _require_db(ctx: click.Context, *, must_exist: bool = False) -> str:
503 """Return the --db path or raise a UsageError if not set.
504
505 When *must_exist* is True, also verify the file is present on disk.
506 """
507 db = ctx.obj["db"]
508 if not db:
509 raise click.UsageError("No database path. Set DB_PATH or pass --db.")
510 if must_exist and not os.path.isfile(db):
511 raise click.UsageError(f"Database not found: {db}")
512 return db
513
514
515@cli.command()

Callers 10

extractFunction · 0.85
diff_db_cmdFunction · 0.85
show_manpageFunction · 0.85
show_distrosFunction · 0.85
show_sectionsFunction · 0.85
show_manpagesFunction · 0.85
show_mappingsFunction · 0.85
show_statsFunction · 0.85
show_eventsFunction · 0.85
db_check_cmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected