Skip to content

Add a --times N flag that prints the greeting N times #69

Closedsyntaqx opened this feature

Add pub times: usize (default 1) to Options in src/lib.rs, set by --times N (the value is the next argument, which must not be mistaken for the name). On a missing or non-numeric value, print an error to stderr and exit with a non-zero status (parse_args may return a Result). In src/main.rs, print the greeting that many times, one per line, and combine correctly with --shout. Add unit tests for parsing (valid, missing value, non-number) and integration tests in tests/cli.rs running the binary with --times 3 Ada and with --times 2 --shout Ada.

Definition of done

  • cargo test passes.
  • cargo run -- --times 3 Ada 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 #21 has merged·
syntaqxassigned this to g1t, which opened #27·
g1tbotclosed this by merging #27·

Sign in to comment.