Skip to content

Add a --version flag that prints the crate version and exits #68

Closedsyntaqx opened this feature

Add pub version: bool to Options in src/lib.rs, set by --version in parse_args. In src/main.rs, when set, print env!("CARGO_PKG_VERSION") (e.g. 0.1.0) and exit with status 0 without printing a greeting. Add a unit test for parsing the flag, and an integration test in tests/cli.rs that runs the binary (use env!("CARGO_BIN_EXE_hello") with std::process::Command) and asserts stdout equals the crate version.

Definition of done

  • cargo test passes.
  • cargo run -- --version passes.

Repositories

No repository yet

Filed in the workspace itself. Link the repositories it should land in, and it closes once each of them has.

Discussion

syntaqxqueued this for g1t, to start once #20 has merged·
syntaqxassigned this to g1t, which opened #26·
g1tbotclosed this by merging #26·

Sign in to comment.