Skip to content

Two saved screens cannot be compared outside a test run; inspect is the only tool and it shows one program #255

Description

@vyncint

Today — the crate ships one runnable tool, examples/inspect.rs, which spawns a program and prints its screen. Measured against 0.9.0: it takes --size, --timeout and --idle, prints text only, and has no notion of a saved screen. Two .snap files — the one in the repository and the .snap.new insta wrote on a failure — can be compared only by cargo insta review, on the machine that ran the tests, in text.

Why it is worth fixing — a coloured, cell-aware diff of two saved screens is useful in three places cargo insta review does not reach: a shell (termlens diff a.snap b.snap after pulling a colleague's failing branch), a CI step (the report action, #251, wants exactly this rendering), and as a dogfooding target — a TUI written and tested with termlens, in this repository, exercising the crate the way its users do. cargo insta review remains the review workflow; this renders a diff, it does not review one.

Fix — grow inspect into a small binary crate, crates/termlens-cli, published as termlens-cli, with subcommands:

Parsing the text format back into a Screen is the one genuinely new piece and belongs in the library behind a parse function so the format is round-trippable; DESIGN §3 already specifies it precisely enough. The example stays until the crate is published, then becomes a two-line pointer.

Done whencargo install termlens-cli provides inspect, diff and render; termlens diff renders Screen::diff of two .snap files with colour on a TTY and exits non-zero on a difference; the text format round-trips through parse; and the CLI's own tests drive it with termlens.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions