Skip to content

[docs] docs/cli.md says bench --dir is inferred from --db, but the code makes it required #234

Description

@radimsem

Summary

docs/cli.md describes the bench --dir flag as "Source directory (inferred from the DB path if omitted)" — but runBench immediately errors with --dir is required if it's empty. There is no inference anywhere in the code. The doc's own example invocation omitting --dir would fail.

Location

  • Doc claim: docs/cli.md:93

    \| --dir \| Source directory (inferred from the DB path if omitted). \|

  • Code reality: cmd/remindb/bench.go:27,36-38
    benchCmd.Flags().StringVar(&benchDir, "dir", "", "Source directory to compile and benchmark (required)")
    ...
    if benchDir == "" {
        return errors.New("--dir is required")
    }
  • The flag's own description string already says (required). Only the docs disagree.

Category

documentation

Impact

High (for a docs finding). A user following the prose ends up with a failing command. Agents reading docs/cli.md as their canonical CLI reference get the same wrong mental model.

Rationale

grep -n "infer\|benchDir" cmd/remindb/bench.go pkg/... finds zero inference logic. The required-flag path is the only code path. The doc claim is simply stale.

Suggested change direction

Two options, pick one:

  1. Fix the docs to match the code (lower-effort, current behavior). Change docs/cli.md:93 to:

    \| --dir \| Source directory to compile and benchmark. **Required.** \|

  2. Implement the inference the docs already promise (better UX). Default --dir to the parent directory of --db (or apply the same derivation compile uses in the inverse direction). This matches the rest of the CLI's "do the obvious thing" defaulting style: compile <path> derives ./<dirname>.db, so bench --db ./notes.db deriving ./notes is symmetric.

Option 2 is more in keeping with the project's flag-defaulting style elsewhere (e.g. compile's --db derivation). Option 1 is the safe one-line fix if the inference was a planned-but-dropped feature.

Filed by the nightly enhancement-scanner routine at commit f11c9f1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-reviewFiled by the nightly enhancement-scanner routinecliAffects the CLI implementationdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions