Skip to content

#137: print usage when --help is requested - #138

Open
RAprogramm wants to merge 1 commit into
objectionary:masterfrom
RAprogramm:137
Open

#137: print usage when --help is requested#138
RAprogramm wants to merge 1 commit into
objectionary:masterfrom
RAprogramm:137

Conversation

@RAprogramm

Copy link
Copy Markdown
Contributor

Closes #137

The first command the README suggests to a newcomer, target/release/phie --help, exited with code 1 and printed File '--help' does not exist, because
parse_args took args[1] as a file name whatever it was.

Two tests were written first and both failed on master:
prints_usage_when_help_is_requested and its -h twin in tests/cli_test.rs.
Then run learned to recognise --help and -h and to answer with the usage
line, and the usage line itself moved into a small usage function so that the
no-arguments error and the help output cannot drift apart.

Behaviour now:

Command Output Exit code
phie --help Usage: phie <file.phie> 0
phie -h Usage: phie <file.phie> 0
phie Usage: phie <file.phie> on stderr 1, as before
phie program.phie the dataized result 0, as before

Verified locally: 243 tests pass including the two new ones, cargo fmt --check
is clean, cargo clippy --all-targets is clean, target/debug/fibonacci 7 10
still prints 21 and 210, reuse lint and typos are clean, and the built binary
was run by hand for all four cases in the table above.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.15%. Comparing base (6025413) to head (fbeaa3f).
⚠️ Report is 3 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

phie --help does not work, while README says it does

1 participant