#137: print usage when --help is requested - #138
Open
RAprogramm wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #138 +/- ##
==========================================
+ Coverage 94.09% 94.15% +0.05%
==========================================
Files 14 14
Lines 711 718 +7
==========================================
+ Hits 669 676 +7
Misses 42 42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #137
The first command the README suggests to a newcomer,
target/release/phie --help, exited with code 1 and printedFile '--help' does not exist, becauseparse_argstookargs[1]as a file name whatever it was.Two tests were written first and both failed on
master:prints_usage_when_help_is_requestedand its-htwin intests/cli_test.rs.Then
runlearned to recognise--helpand-hand to answer with the usageline, and the usage line itself moved into a small
usagefunction so that theno-arguments error and the help output cannot drift apart.
Behaviour now:
phie --helpUsage: phie <file.phie>phie -hUsage: phie <file.phie>phieUsage: phie <file.phie>on stderrphie program.phieVerified locally: 243 tests pass including the two new ones,
cargo fmt --checkis clean,
cargo clippy --all-targetsis clean,target/debug/fibonacci 7 10still prints 21 and 210,
reuse lintandtyposare clean, and the built binarywas run by hand for all four cases in the table above.