-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Removing long help strings from the source code #2816
Comments
tertsdiepraam
changed the title
Removing long help from the source code
Removing long help strings from the source code
Dec 29, 2021
This was referenced Feb 22, 2022
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still relevant :) |
Closing this ticket as it has been implemented in the meantime. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some utils have long strings that are passed to the "long help" section of Clap (or "after help").
Take for instance this bit from
test
:I think does not really belong in the source code because
The solution that I would like to propose is a new macro:
help_section!
. It reads the contents from a file calledhelp.md
at the crate root which can contain several sections delimited by#
(like Markdown). Here is an example fornumfmt
:help.md
numfmt.rs
I have an implementation that is (at least should be) ready for use, except for some error handling, but I wanted to discuss whether this is desirable first. There are a couple of downsides to this approach that I can think of:
#
are supported.help.md
can also be used as a string literal for aformat!
call. Nevertheless, it could still be weird.main!
,gen_uumain!
,show!
,crash!
etc..help.md
andhelp_section!
are also open to discussion. Maybe it should behelp.txt
, or the macro should take the file its reading from as an argument (likeinclude_str!
), so it would beinclude_section("help.md", "about")
or something like that.What do you think?
The text was updated successfully, but these errors were encountered: