Skip to content

termlens inspect cannot set the working directory, though the builder can #312

Description

@vyncint

Todaytermlens inspect forwards a useful subset of TerminalBuilder to the command line: --size, --timeout, --idle, --inherit-env, --env, --ansi. Measured on 0.10.1, grep -oE '"--[a-z-]+"' crates/termlens-cli/src/main.rs shows no --cwd, and TerminalBuilder::current_dir has no way through — so inspecting a program that reads files relative to its working directory means cd first, and inspecting one that must run elsewhere is impossible without a subshell.

Why it is worth fixinginspect exists so you can point the harness at a program without writing a test. The working directory is part of "how the program is normally run", and it is already a builder method — this is plumbing, not design.

Fix — add --cwd PATH to the inspect flag loop in crates/termlens-cli/src/main.rs, calling TerminalBuilder::current_dir. Follow --size's error shape for a path that does not exist: name the flag and show what was expected. Mention it in INSPECT_USAGE and in crates/termlens-cli/README.md.

Done when

  • termlens inspect --cwd /tmp sh -c pwd shows /tmp.
  • A missing directory fails with a one-line diagnostic and exit code 2, not a panic.
  • crates/termlens-cli/tests/cli.rs covers both.

A good first contribution: one file, no architecture decisions. Start with
CONTRIBUTING.md
— §1 lists every gate you can run locally, and §3 asks that a change land
with a test. Commits are Conventional Commits and need git commit -s
(DCO). Happy to review a draft PR early.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions