-
Notifications
You must be signed in to change notification settings - Fork 0
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
DRY versatile cmdline doc generation (manpage, -h msg, html etc) via a DSL #661
Comments
I've started on a solution which I think addresses a fair bit of these issues. Mostly just posting here for posterity, and at least a look at a possible DSL solution. |
thanks, looks like a good start, I'll comment in your repo later |
You did not specify what exactly is so ugly about our cmdline docs. I see only one defect: that descriptions for long options can be confused together because they merge visually. We should solve it at the CSS style level IMHO. I don't understand what you see in "good looking examples". They all waste too much of page space for gaps between options. Summary:
|
A DSL would be the most flexible option, allowing to render differently for for rst, html cmdline help output or even integrating the command line processing logic, etc, as well as being reusable for other cmdline tools (nimgrep, nimsuggest, nimfind etc) as well as 3rd party packages (nimble etc). Note that writing directly the cmdline to RST is less flexible (conditional generation per target, string processing) examples where our 2 column layout is bad |
The first example is just a syntax error and it's already been fixed in nim-lang@8db93fd Second example can be cured by inserting HTML |
yes, good, i saw that.
even then i still don't like the layout, it feels cramped, wastes space that could be used to explain our cmdline better without a ton of wasted space, both in the html rendering and in the cmdline output of With a very simple modification to match to the style i mentioned earlier (that is followed by all others i mentioned, python clang, D, etc), i already improve the results: rst after reflowing away from 2 columns: https://gist.github.com/timotheecour/3fcc84cde4481e7a7849c937e0f832c3 html output after this modification:(it also looks good when dumped via --fullhelp on cmdline) it could be improved further by ensuring each flag appears in bold; but this should be done automatically and the rst source with flags+description shouldn't have to mentioning styling (hence the DSL i suggested, but happy to discuss other options that improve styling) current html output from https://nim-lang.github.io/Nim/nimc.html:notenote that the rst renders good in github (https://gist.github.com/timotheecour/3fcc84cde4481e7a7849c937e0f832c3) with each option in bold. if github does it, can |
/cc @a-mr
our docs generally look good, but cmdline docs are bad:
not DRY
these are manually (IIRC) maintained and generated:
nim-lang#17415 attempts to make nimgrep cmdline docs DRY (which is good) but at cost of introducing artifacts (as noted in PR comments)
ugly/hard to read
compare https://nim-lang.github.io/Nim/nimc.html vs docs for other projects, see below
good looking command line reference docs
proposal
provide tooling allowing to write cmdline docs that are:
implementation
generate the doc string in pure nim using a DSL (similar to karax https://github.com/pragmagic/karax but much simpler), leveraging full power of nim to handle things like inserting variable names, dates, auto-generated content, etc
the DSL logic would be in some module
std/cmdlineutils
then CI auto-generates the various artifacts for each rendering target:
example std/cmdlineutils DSL usage
now we can use
help
in different rendering contexts:help
to handle cmdline input and look like this:links
man nim
: No manual entry for nim nim-lang/Nim#7401The text was updated successfully, but these errors were encountered: