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

Synopsis of man page generator: incorrect asciidoctor call #1058

Closed
deining opened this issue May 19, 2020 · 4 comments
Closed

Synopsis of man page generator: incorrect asciidoctor call #1058

deining opened this issue May 19, 2020 · 4 comments

Comments

@deining
Copy link
Contributor

deining commented May 19, 2020

Synopsis of man page generator:

Usage: gen-manpage [-fhVv] [--[no-]exit] [-c=<factoryClass>] [-d=<outdir>] [-t=<template-dir>] [@<filename>...] <classes>...
...
...
Converting to Man Page Format

Use the `asciidoctor` tool to convert the generated AsciiDoc files to man pages in roff format:

`asciidoctor --backend=manpage --source-dir=SOURCE_DIR --destination-dir=DESTINATION`

The asciidoctor command is missing the required parameter FILE..., should be:

asciidoctor --backend=manpage --source-dir=SOURCE_DIR --destination-dir=DESTINATION *.adoc

I submitted a PR meanwhile (#1059).

Additional question:

I do have a localized, picocli based application. Can I use the man page generator to generate *.adoc files in my various language variants?

@remkop
Copy link
Owner

remkop commented May 19, 2020

Thank you for pointing out the problem in the docs and for the PR to fix it!

I do have a localized, picocli based application. Can I use the man page generator to generate *.adoc files in my various language variants?

I haven't actually tried this, but yes, that should be possible. When you invoke the ManPageGenerator command, if you set the target locale by specifying the user.language, user.country, and user.variant system properties, the generated usage help should use the resource bundle based on the user locale.

(We should probably add a section about this to the documentation for generating man pages.)

@deining
Copy link
Contributor Author

deining commented May 20, 2020

I haven't actually tried this, but yes, that should be possible. When you invoke the ManPageGenerator command, if you set the target locale by specifying the user.language, user.country, and user.variant system properties, the generated usage help should use the resource bundle based on the user locale.

I can confirm that this works, indeed.

(We should probably add a section about this to the documentation for generating man pages.)

I try to author a PR later on.

Additional note:

Man page generation is a great feature. Currently, it is somehow hidden, however. Can't we make it more accessible by giving an picocli based application the ability to generate its own man page on demand (via subcommand). Something like:

@Command(name = "mycommand", subcommands = GenerateManPage.class)
public class MyApp implements Runnable {
...
}

Can this be implemented? Or does this feature exist already? Would be a great addition IMHO.

@remkop
Copy link
Owner

remkop commented May 20, 2020

Can't we make it more accessible by giving an picocli based application the ability to generate its own man page on demand (via subcommand).

I see. I hadn't thought of that but that is a nice idea.
Currently the logic lives in a private static inner class: picocli.codegen.docgen.manpage.ManPageGenerator.App.
One idea is to rename App to Command and make it public.

@remkop
Copy link
Owner

remkop commented May 20, 2020

One idea is to rename App to Command and make it public.

Another idea is to remove the innner App class altogether and move the annotations and annotated fields to the ManPageGenerator class itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants