-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add examples to cli --help #5388
Conversation
542fc12
to
973e38d
Compare
973e38d
to
a9b1628
Compare
Screen.Recording.2023-12-15.at.14.50.30.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be really nice! Thanks for the testing infra for examples as well. It seems like we are touching forc-crypto
, forc-doc
and forc
itself in this PR, are we planning to touch to forc-client
, forc-submit
as well? If so let's mark this as a draft if you want to break it into couple of ones we should probably update the title and description.
I am adding more examples now |
e122b44
to
5aa71ac
Compare
The commands wil be broken into multiple lines automatically
45bd774
to
3832995
Compare
… into plugins-examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think examples look comprehensive enough! Nice work, I can approve again after josh's comments
Todo:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Description Add recover-public-key to forc-crypto This function is ported from FuelLabs/forc-wallet#152 This PR depends on #5388 ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
Description
Fixes #5398, #5374. This PR depends on #5433
Add examples to our
--help
cli. The examples are defined through the a macroforc::cli_examples { }
and each of these examples is part of the the test suite of the crate. This is done to ensure the documentation is always up to date or updated whenever the tests are not passing.All the CLI examples should be provided with the
forc::cli_examples!
macro.The above example will create two unit tests that will be run as part of the
cargo test
inside the project. The unit test will be done with an external invocation, meaning it can be treated like an end-to-end test instead of a unit test. If the binary interface changes, the tests should fail, forcing the developer to either update the tests (which is the documentation) or keep them backward compatible. The ultimate goal is to have documentation that is up to date, enforced by the github actions/unit test.Last bit not least the macro will create a
help()
function which is local to the file, this file does the printing with--help
is invoked. It should be used as follows:Checklist
Breaking*
orNew Feature
labels where relevant.