Skip to content

launchbound-tui --help looks for a directory called --help #23

Description

@vyncint

Reproduce

$ launchbound-tui --help
Error: run dir: --help/verdicts.json: No such file or directory (os error 2) (stage writes it)

Every conventional form does the same — the flag is taken as a path:

argument result
--help run dir: --help/verdicts.json: No such file...
-h run dir: -h/verdicts.json: No such file...
--version run dir: --version/verdicts.json: No such file...
-V run dir: -V/verdicts.json: No such file...
(none) usage: launchbound-tui <run-dir>

Why

crates/launchbound-tui/src/main.rs:19 reads std::env::args() directly. There is no argument parsing, so nothing distinguishes a flag from a path.

Why it matters

launchbound-tui is published — crates.io shows 1.2.0 with 66 downloads — so this is what an installed user gets. --help is the first thing anyone types at an unfamiliar binary, and the reply is an error about a file named --help, which reads as a bug in the tool rather than as "that flag does not exist".

It is also the only binary in the workspace that behaves this way: launchbound uses clap and answers --help and --version properly.

Fix

The bare-argument reading is fine for one positional — this does not need clap pulled in if that is unwanted. Two lines get most of the value:

match arg.as_deref() {
    Some("-h" | "--help") => { print_usage(); return Ok(()); }
    Some("-V" | "--version") => { println!("launchbound-tui {}", env!("CARGO_PKG_VERSION")); return Ok(()); }
    Some(path) if path.starts_with('-') => bail!("unknown option `{path}`; usage: launchbound-tui <run-dir>"),
    ...
}

The usage text has somewhere useful to point, since the run directory comes from launchbound stage or launchbound tune:

usage: launchbound-tui <run-dir>

  <run-dir>   a directory written by `launchbound stage` or `launchbound tune`,
              containing verdicts.json (and results.json once measured)

  1 overview · 2 ranking · 3 rejections · 4 progress · j/k scroll · q quit

Rejecting any unrecognised leading-dash argument is the part that stops this recurring — otherwise --ascii or --no-color will land here next.

Done when

launchbound-tui --help and --version answer, and an unknown flag is reported as an unknown flag rather than as a missing directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions