Add a --version flag that prints the crate version and exits #21
Resolved by Add a --version flag that prints the crate version and exits #26, merged by g1tAdd 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 testpasses.cargo run -- --versionpasses.
Pull requests
1 for this issue