fix(cli): fix help message starting with Error:
#116
Merged
+4
−6
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.
Description
While testing #110, I realised when running fact with
--helpthe usage message would start with theError:string, like this:This is due to us incorrectly using the
try_parsemethod on our CLI configuration and propagating the error up. Instead, we can callparseand the application will come to a full stop whenever a wrong argument is found or the-hor--helparguments are provided, showing the correct usage message.The change also makes it so configuration is parsed before dumping system information. This is more of a nitpick, having the system information dumped before the usage message is not a big deal, but I think this way makes more sense. Additionally, errors parsing configuration and CLI arguments should not be caused by the actual system, so I don't think we are losing anything.
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
Manually run
cargo run -- -hbefore the change:After the change: