flagon-io/hello

public

Greets people from the command line. The sample repository for g1t.

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

Closedsyntaqx opened this feature
Resolved by Add a --version flag that prints the crate version and exits #26, merged by g1t

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.

Pull requests

1 for this issue

Discussion

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

Sign in to comment.