-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support for markdown output in help messages #29
Conversation
Users of CLIC can use this functionality to provide on-line versions of the help messages.
This is the suggested improvement of the idea I already tried in alire-project/alire.ada.dev#23 I have the application to Alire also ready, but it is straightforward from the example. In any case, I will do an associated PR shortly. I paste some examples of the output. It can be improved if more changes are made in how the help message is composed. I feel that the decoration of the message should be more semantic, so it could accommodate better Markdown and other future formats if needed (although markdown is already a good input format for many conversors). |
clic_example 0.0.0 USAGEclic_example [global options] [command options] [] clic_example help [|] ARGUMENTS
GLOBAL OPTIONS
COMMANDS
TOPICS
ALIASES
|
SUMMARYList, Get, Set or Unset configuration options USAGEclic_example config [options] [--list] [--show-origin] [key_regex] | --get | --set | --unset OPTIONS
GLOBAL OPTIONS
DESCRIPTIONProvides a command line interface to the Alire configuration option files. Option names (keys) can use lowercase and uppercase alphanumeric characters Option values can be integers, float, Boolean (true or false) or strings. The Built-in configuration options: |
SUMMARYPrint all the sub-command switches and args USAGEclic_example switches_and_args [options] [switches] [args] GLOBAL OPTIONS
DESCRIPTION |
One difficult topic is alignment of the lists using In my opinion, the long option should also be wrapped with the GLOBAL OPTIONS
|
This functionality can be used to provide on-line versions of the help messages for alire.ada.dev. It goes with alire-project/clic#29
|
||
procedure Force_Disable_TTY; | ||
|
||
procedure Enable_Markdown; |
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.
For me this is not the right way to add a Markdown output for the help pages. You may want to print the help in markdown without changing the formatting of the other outputs of your program.
Also it doesn't make much sens to outputting markdown for other parts of a command line program.
What I did for my [Man page POChttps://github.com//pull/12/files)) is to add a special Print_Man_Page
to the CLIC.Subcommand.Instance
package.
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.
But I like the idea of a Markdown output for the help :)
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.
My rationale for doing it through the formatting parameters of CLIC.Subcommand.Instance
is that all the logic already present in Display_Help
can be reused. In fact, when looking at that generic parameters, I figured out that something like I'm doing was envisioned.
For example, the recent change about the global switches (a6bea52) would have to be applied in two places if there is a different help page generation for both formats like in #12. Isn't it better if there is a single place where the page is composed and the format can be parameterized?
You may want to print the help in markdown without changing the formatting of the other outputs of your program.
But the help printing is a single purpose command. When you print the help page, either for generating a markdown format or for directly reading, this will be the single action performed by the application, it doesn't make sense to generate any other output.
Where I agree undoubtedly is that, instead of a global switch (--markdown
) to be combined with --help
as I thought it, it should be a single switch for a specific subcommand. I was influence by how --no-tty
and similar switches worked and implemented it similarly, but always thinking in this --markdown
switch to be used along with --help
or the help
subcommand, not for any other program output.
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.
Isn't it better if there is a single place where the page is composed and the format can be parameterized?
This solution does work with TTY and Markdown, but it's not going to work for Man or HTML because of more complex output structures (lists in HTML for instance). So we will need another ad-hoc way to have those formats.
@mosteo up to you.
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.
If Markdown works well, HTML is indeed the final output of the former.
But, in any case, if @mosteo thinks the same, I don't have any problem in changing it to the other approach.
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 we should emit a single format that is suitable for conversion with e.g. pandoc
rather than having multiple generators. If the logic can be reused for the single chosen format, I'd prefer that, but if as @Fabien-Chouteau says, there are structures that won't work, then that forces our hand to have a separate generator.
The way I'd go about it would be to use a sample complex page to check both issues: that it can be converted properly and whether the existent logic can be reused.
Superseded by #30 |
Users of CLIC can use this functionality to provide on-line versions of the help messages.