Skip to content

Add version information and CLI argument parsing - #17

Merged
ad-si merged 1 commit into
mainfrom
claude/luacad-issue-15-cdqpul
Aug 20, 2026
Merged

Add version information and CLI argument parsing#17
ad-si merged 1 commit into
mainfrom
claude/luacad-issue-15-cdqpul

Conversation

@ad-si

@ad-si ad-si commented Aug 20, 2026

Copy link
Copy Markdown
Owner

This PR adds comprehensive version information to both the luacad and luacad-studio binaries, along with proper command-line argument parsing for Studio.

Summary

The changes introduce a build-time version module that embeds the crate version, git commit information (when built from a git checkout), and build target. Both binaries now support -v/--version and -h/--help flags that exit immediately. Studio gains an "About" settings tab and button to display this information in the GUI.

Key Changes

  • New luacad/src/version.rs: Module that exposes version constants (CRATE_VERSION, GIT_DESCRIBE, BUILD_TARGET, VERSION) populated by the build script
  • New luacad/build.rs: Build script that runs git describe --always --dirty --tags to capture commit information, with support for LUACAD_GIT_DESCRIBE environment variable for reproducible builds
  • Studio CLI parsing: Replaced manual std::env::args() parsing with clap to properly handle -v/--version, -h/--help, and file arguments. Added without_launch_serial() to filter macOS LaunchServices' -psn_* flags
  • Studio UI enhancements:
    • New "About" tab (index 2) in settings dialog showing version, commit, and build target
    • New ℹ About button in both editor panel and bottom bar for quick access
    • about_row() helper function for consistent label/value display with selectable text for bug reports
    • "Copy version info" button in About tab
  • Test infrastructure: Added painted_text tracking to UI test harness to verify version information appears in the About tab and About button is accessible when editor is hidden
  • Documentation: Updated README files and changelog to document the new version information behavior and CLI flags

Implementation Details

  • Version string format: plain crate version for releases, or {version} ({git_describe}) for development builds
  • Build script intelligently avoids redundant suffixes (e.g., at release tags where git describe equals the crate version)
  • Git directory watching ensures rebuilds when commits change
  • Both luacad and luacad-studio CLIs use the same version constant for consistency

https://claude.ai/code/session_01U7tjYSVoJDhm6ShFTGjz2S

…naries

`luacad-studio` used to ignore everything but the first argument, so `-h`
and `-v` silently started the GUI instead of answering. It now parses its
command line with clap, like the `luacad` CLI: `[file.lua]` is a declared
argument, unknown flags are reported, and `-h`/`--help` and `-v`/`--version`
print and exit before a window is created. macOS' `-psn_…` process serial
number is dropped first, so opening the app from Finder still works.

A build script bakes `git describe --always --dirty --tags` into the version
of a build made from a git checkout (`1.1.0 (v1.1.0-3-g23a0ea2-dirty)`), so a
locally built binary can be identified without hashing it. Builds without a
checkout, and clean release tags, keep the plain crate version;
`LUACAD_GIT_DESCRIBE` overrides the suffix for reproducible packaging. The
release job now checks out the full history, which `git describe` needs.

In the GUI the same information lives in Settings → About, opened by the new
`ℹ About` button next to Settings (and by one in the bottom bar while the
code editor is hidden), together with the build target and a button that
copies it all for a bug report.

Closes #15

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U7tjYSVoJDhm6ShFTGjz2S
@ad-si
ad-si merged commit 5661bc5 into main Aug 20, 2026
14 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.

1 participant