Skip to content

feat(cli): consolidate --help and --version output across all binaries - #40

Open
rodonile wants to merge 1 commit into
network-analytics:mainfrom
rodonile:cli-consolidate
Open

feat(cli): consolidate --help and --version output across all binaries#40
rodonile wants to merge 1 commit into
network-analytics:mainfrom
rodonile:cli-consolidate

Conversation

@rodonile

Copy link
Copy Markdown
Member

This PR depends on #39.

Summary

Adds consistent, detailed --version / -V output across the CLI binaries
(pcap-decoder, collector, yang-consumer), showing commit hash/date,
branch/tag, build time, Rust toolchain, and OS.

Changes

  • pcap-decoder: added build.rs + shadow-rs build-dependency (mirrors
    collector/yang-consumer setup) and a custom version_info() used for
    --version.
  • collector: replaced the manual -v/--version boolean flag and
    early-exit branch with clap's built-in ArgAction::Version (-V), which
    lets --version run without requiring config_file to be provided.
  • yang-consumer: switched from clap's default #[command(version)] to
    the same custom multi-line version_info() used elsewhere.

@rodonile rodonile self-assigned this Aug 13, 2026
@rodonile
rodonile force-pushed the cli-consolidate branch 2 times, most recently from 47f2ac0 to ed28170 Compare August 21, 2026 07:49
@rodonile
rodonile requested a lite review from Copilot September 1, 2026 11:13
@rodonile
rodonile marked this pull request as ready for review September 1, 2026 11:14
@rodonile
rodonile enabled auto-merge (rebase) September 1, 2026 11:14
@rodonile
rodonile disabled auto-merge September 1, 2026 11:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes --version / -V output across the workspace’s CLI binaries by switching to a shared multi-line build-info version string (commit, branch/tag, build time, toolchain, OS) and aligning clap configuration so --version can exit early without requiring other arguments.

Changes:

  • Added a shared-style version_info() multi-line string to collector, pcap-decoder, and yang-consumer, and wired it into clap’s version handling.
  • Updated collector to use clap’s ArgAction::Version (-V) instead of a manual -v/--version early-exit branch, and made config_file required again.
  • Added shadow-rs build integration for pcap-decoder (new build.rs, Cargo.toml updates, lockfile update).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/yang-consumer/src/main.rs Adds custom multi-line version info and a -V/--version flag using clap’s version action.
crates/pcap-decoder/src/main.rs Adds shadow-rs build metadata and uses the shared multi-line version output via clap.
crates/pcap-decoder/Cargo.toml Enables a build script and adds shadow-rs dependency/build-dependency.
crates/pcap-decoder/build.rs Generates shadow-rs build metadata during compilation.
crates/collector/src/main.rs Replaces manual version printing with clap’s version action and shared version string.
Cargo.lock Records the new shadow-rs dependency for pcap-decoder.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/collector/src/main.rs
Comment thread crates/yang-consumer/src/main.rs
Comment thread crates/pcap-decoder/src/main.rs
@ustorbeck
ustorbeck self-requested a review September 1, 2026 11:42
ustorbeck
ustorbeck previously approved these changes Sep 1, 2026
Add build.rs/shadow-rs wiring to pcap-decoder so `--version` prints
commit, branch, build time, rustc and OS info like collector and
yang-consumer. Also switch collector and yang-consumer to clap's
native ArgAction::Version (-V) so --version works without requiring
other positional/required args.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Comment thread crates/pcap-decoder/Cargo.toml
Comment thread crates/collector/src/main.rs
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.

3 participants