Skip to content
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 $usehdr template variable #240

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Conversation

AngelEzquerra
Copy link
Contributor

Also avoid adding the usage header at the top of the help message when the usage template string is customized and the $usehdr template variable (or the default "Usage:\n" header) is used in it.

Note that this does not change the default behavior in any way. It only makes it easier to completely customize the help message by simply changing the usage template string without having to also set the noHdr flag.

If the usage string contains the _default_ usage string or the $usehdr template variable, do not add the usage header at the top of the help message.

This keeps the existing, default behavior unchanged but makes it easier to use a different "help template" that does not start with the usage section by simply changing the usage string.
@c-blake
Copy link
Owner

c-blake commented Nov 7, 2024

This seems a good start!

One logic thing I see is that std/strutils.% can accept either "$usehdr" or "${usehdr}" substrings. So, you probably want that "$usehdr" notin use to become not("$usehdr" in use or "${usehdr}" in use). No?

I'd say it's fine to alter the location of $usehdr to before ${doc} in the usage template in the altered test/PassValues.nim. Related to the prior point, you don't need braces after $ there since unlike $doc it isn't followed by literal "Options:\n" text, but they are allowed & I could see someone's impulse being to use them.1

Having updated test/PassValues --help output, we'll want to fix the reference output (I usually just cp test/out test/ref after manual inspection of ./test.sh output.). Then finally, we'll want a RELEASE_NOTES.md entry for this for the upcoming version 1.7.8. I can do these last two bits post-PR-merge if you want, though.

Footnotes

  1. I often use these things as demo/URI link targets for answers to questions (so the asker gets some "fully worked out context" example). A big FAQ/page of such pointers is one way we could expand the Wiki to actually document the 50..100 features/HOWTOs probably documented mostly in RELEASE_NOTES.md or source/config comments.

@c-blake c-blake merged commit fa138de into c-blake:master Nov 7, 2024
6 checks passed
@c-blake
Copy link
Owner

c-blake commented Nov 7, 2024

I had some changes in related lines of code that I wanted to make. So, I just merged this and added my recommended updates to the PR.

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.

2 participants