Skip to content

fix(cli): print --version and --help instead of booting the app - #384

Merged
pacifio merged 1 commit into
pacifio:0.4.1from
Yi-111-a:fix/version-flag-371
Oct 8, 2026
Merged

pacifio merged 1 commit into
pacifio:0.4.1from
Yi-111-a:fix/version-flag-371

Conversation

@Yi-111-a

@Yi-111-a Yi-111-a commented Oct 7, 2026

Copy link
Copy Markdown

What?

atlas --version (and --help) now print and exit when they reach the app binary, instead of opening a window.

Why?

The binary only checks argv for a project path. parse_project_path returns None for anything starting with -, so --version falls through to a normal launch: the window opens and no version is ever printed (#371, seen with /usr/bin/tryatlas --version on Arch).

The ~/.local/bin/atlas shell helper already handles both flags, but it is not always in front of the binary. On Linux, cli_install_helper skips the helper when a system binary exists, so atlas is the binary there. A terminal pointed at the bundle hits the binary directly too. As the issue explains, a version check that boots a GUI instance can also take later launches as second-instance forwards.

No new dependencies. I didn't add clap for two flags, same as the existing comment on parse_initial_project says.

How?

  • commands/cli.rs: parse_info_flag(&[String]) -> Option<InfoFlag> recognises --version/-v/-V and --help/-h as the first argument (the helper accepts the same flags, plus -V). info_flag_text builds the output, and handle_info_flag prints it. The version line is atlas <CARGO_PKG_VERSION>, the same line the helper prints.
  • lib.rs: run() calls handle_info_flag() first and returns early. That happens before the profile init, logging, .env loading and tauri::Builder, so in a release build the single-instance plugin never sees the call either.
  • Tests in cli.rs: every flag spelling is recognised. Paths, unrelated flags, and a flag that isn't the first argument are left to the normal launch. The version line is checked against the echo "atlas {{VERSION}}" line in bin/atlas-cli.sh, so the two entry points can't drift apart.

Target is 0.4.1, the current version branch.

Fixes #371

Checklist

  • Targets the current version branch, unless it's a small standalone fix
  • New behaviour has a test; a bug fix has a test that fails without it
  • You've run the app and used the change in a window

I couldn't build the whole Tauri app on my Linux machine, so I haven't run the change in a window. I tested the new functions on their own: I compiled them unchanged with rustc --test (3/3 pass) and ran them as a tiny binary (--version → atlas 0.4.1, -h → usage, . / --verbose → normal launch path). Clippy with the workspace's deny list and rustfmt --check are clean on both changed files. CI's cargo test --lib and clippy for src-tauri will run the real build.

The binary only looked for a project path on argv, so `--version` (a
flag, therefore no project) fell through to a normal launch and opened
a window. On Linux the system package's binary is what `atlas` runs,
since the shell helper is not installed there, so the flag never worked.

Answer --version/-v/-V and --help/-h first thing in run(), before Tauri,
logging or the single-instance forward, with the same `atlas <version>`
line the shell helper prints.

Fixes pacifio#371
@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 377ed6ba-4b95-41c1-b2df-e2d95651962e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@pacifio
pacifio merged commit 987226c into pacifio:0.4.1 Oct 8, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants