-
Notifications
You must be signed in to change notification settings - Fork 431
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
Linux friendly manpage generation #459
Comments
That’s a great idea! |
Actually, if we use
Though, my free time is quite limited, but knowing this feature is welcomed and would be accepted, and also I want to use it, I would like to provide a PR for this.
Could you provide whole high level concept, or solution design, for this feature? Ie.
|
All good points.
The idea/hope is that content type (mime type) would make it extensible: Also not sure what the return type of the method should be. Either return a String, or void and print to standard out? (The latter would allow binary output formats.) Thoughts? |
I thought of new dependency for But, documentation generation isn't needed for application/tool at runtime. Documentation is generated during build. Ie. once, then all docgen code isn't needed anymore. And, putting it into picocli core would just make runtime dependencies unnecessarily bigger. And, so you think of whole new artifact, and/or github project? Or, what's yours idea about new artifact
From my point of view, the docgen process is defined by three parts:
I dislike idea to use standard output for generated outputs.. It just complicates things. I like to think in functional way, where methods have got input, and generate output. Then, such methods can be used, and composed, in various ways without limitations. |
Also, output type can be DocBook SGML, which can be then converted to manpage using |
I was thinking to create a module About the |
About mine type for man pages: According to Files with extension Potentially related:
according to https://bugs.freedesktop.org/show_bug.cgi?id=5072 |
I will rename the existing If you want, I can create a |
Perhaps doxygen is a good tool to use for this ticket. Alternatively we can just generate raw man groff macros. This page and this page show some examples. This article also gives a nice overview. All in all it looks doable. @kravemir Are you still interested in this? Should I go ahead and create the |
@remkop: yes, I'm interested in this. It's on my todo-list, but there are still some task before this. One was to create picocli debian package and get it uploaded to debian official repositories. I saw readme, and thanks for attribution :-) Though, if you want to refer me on debian, you can use https://udd.debian.org/dmd/?kravec.miroslav%40gmail.com or https://qa.debian.org/developer.php?login=kravec.miroslav%40gmail.com. And, regarding this feature. I thought about first implementing some solution directly for my tool, then make it as reusable solution, and create PR for picocli containing the implementation. |
Understood. Thank you again for creating the debian package! I updated the links on the README page, let me know if these links need further correction. About this ticket, glad to hear you are still interested. |
I think DocBook is a very flexible way to support multiple output formats. There exists the https://github.com/asciidoctor/asciidoctorj project to parse or convert AsciiDoc documents programmatically. AsciiDoc is very easy to write for humans (also and very readable), however I don't know how easy it is for a machine to generate AsciiDoc or whether AsciidoctorJ provides an API to create AsciiDoc documents. |
I love AsciiDoc: all picocli documentation is written in AsciiDoc. :-) Can you give details on how a text in AsciiDoc format can be transformed to man page format? |
A description on how to do it via commandline is given in As far as I know, AsciidoctorJ also supports this. There are some restrictions on the format of the AsciiDoc document, but that shouldn't be a problem. |
An initial version of You can test by checking out the latest master and building with:
That should publish Here is an example Gradle dependencies {
compile "info.picocli:picocli:4.2.0-SNAPSHOT"
annotationProcessor "info.picocli:picocli-codegen:4.2.0-SNAPSHOT"
}
mainClassName = "my.pkg.MyCommand"
task generateManpageAsciiDoc(type: JavaExec) {
dependsOn(classes)
group = "Documentation"
description = "Generate AsciiDoc manpage"
classpath(configurations.compile, configurations.annotationProcessor, sourceSets.main.runtimeClasspath)
main 'picocli.codegen.docgen.manpage.ManPageGenerator'
args mainClassName, "--outdir=${project.buildDir}/generated/docs", "-v" //, "--template-dir=src/docs/mantemplates"
}
apply plugin: 'org.asciidoctor.convert'
asciidoctor {
dependsOn(generateManpageAsciiDoc)
sourceDir = file("${project.buildDir}/generated/docs")
outputDir = file("${project.buildDir}/docs")
logDocuments = true
backends 'manpage'
} The The
CustomizationThe generated man page is very similar to the online help generated by the command itself when a user specifies the To create customized man pages, first point the Let's call this new directory In its simplest form we can include the full generated page with the
It is also possible to include the picocli-generated sections individually, so that the generated sections can be customized with additional text that follows the generated text for the section. For example:
(These tag names may be changed before the picocli 4.2.0 release.) Known issues:
Update: the above known issues are all resolved now in master. Feedback welcome! |
…ns and header/footer text to custom `IStyle`s
picocli 4.2.0 has been released, including this functionality. Enjoy! |
I'm using
picocli
for my project, and I would like to create manual page for it.Is there any recommended approach to generate a manual page for standard linux's command
man
?Issue type, depending on possibilities: question, feature suggestion, or article/documentation improvement request.
The text was updated successfully, but these errors were encountered: