Synopsis
gen-manpage [-fhVv] [--[no-]exit] [-c=<factoryClass>] [-d=<outdir>] [-t=<template-dir>] [@<filename>…] <classes>…
Description
Generates one or more AsciiDoc files with doctype 'manpage' in the specified directory.
Options
- -d, --outdir=<outdir>
-
Output directory to write the generated AsciiDoc files to. If not specified, files are written to the current directory.
- -t, --template-dir=<template-dir>
-
Optional directory to write customizable man page template files. If specified, an additional "template" file is created here for each generated manpage AsciiDoc file.
Each template file contains
include
directives that import content from the corresponding generated manpage AsciiDoc file in the--outdir
directory. Text can be added after each include to customize the resulting man page. The resulting man page will be a mixture of generated and manually edited text.These customizable templates are intended to be generated once, and afterwards be manually updated and maintained.
- -v, --verbose
-
Specify multiple -v options to increase verbosity.
For example,
-v -v -v
or-vvv
- -f, --[no-]force
-
Overwrite existing man page templates. The default is
--no-force
, meaning processing is aborted and the process exits with status code 4 if a man page template file already exists. - -c, --factory=<factoryClass>
-
Optionally specify the fully qualified class name of the custom factory to use to instantiate the command class. If omitted, the default picocli factory is used.
- --[no-]exit
-
Specify
--exit
if you want the application to callSystem.exit
when finished. By default,System.exit
is not called. - -h, --help
-
Show this help message and exit.
- -V, --version
-
Print version information and exit.
Arguments
- [@<filename>…]
-
One or more argument files containing options.
- <classes>…
-
One or more command classes to generate man pages for.
Exit Codes (if enabled with --exit
)
- 0
-
Successful program execution.
- 1
-
A runtime exception occurred while generating man pages.
- 2
-
Usage error: user input for the command was incorrect, e.g., the wrong number of arguments, a bad flag, a bad syntax in a parameter, etc.
- 4
-
A template file exists in the template directory. (Remove the
--template-dir
option or use--force
to overwrite.)
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 *.adoc
Point the SOURCE_DIR to either the --outdir
directory or the --template-dir
directory. Use some other directory as the DESTINATION.
See https://asciidoctor.org/docs/user-manual/#man-pages
See http://man7.org/linux/man-pages/man7/roff.7.html
In order to generate localized man pages, set the target locale by specifying the user.language, user.country, and user.variant system properties.
The generated usage help will then contain information retrieved from the resource bundle based on the user locale.
Example
java -Duser.language=de -cp "myapp.jar;picocli-4.7.6.jar;picocli-codegen-4.7.6.jar" picocli.codegen.docgen.manpage.ManPageGenerator my.pkg.MyClass