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

missing tags for empty items in adoc man page #1337

Closed
crotwell opened this issue Mar 3, 2021 · 1 comment
Closed

missing tags for empty items in adoc man page #1337

crotwell opened this issue Mar 3, 2021 · 1 comment
Labels
theme: codegen An issue or change related to the picocli-codegen module type: enhancement ✨
Milestone

Comments

@crotwell
Copy link
Contributor

crotwell commented Mar 3, 2021

By default the asciidoc man page templates include lines like:

include::{includedir}/xxx.adoc[tag=picocli-generated-man-section-exit-status]

But a commands without an exit status, these tags are missing in the generated asciidoc man files. This causes asciidoctor to emit a warning like:

WARNING: xxx.adoc: line 19: tag 'picocli-generated-man-section-exit-status' not found in include file: xxxxxx/build/picocli/man/xxx.adoc

While commenting out the import lines in the template is easy enough, it would be nice if the asciidoc generator could put in empty tages like:

// tag::picocli-generated-man-section-exit-status[]
// end::picocli-generated-man-section-exit-status[]

so that the no warning is printed.

A fix would be to change

    static void genExitStatus(PrintWriter pw, CommandSpec spec) {
        if (spec.usageMessage().exitCodeList().isEmpty()) {
            return;
        }

to

    static void genExitStatus(PrintWriter pw, CommandSpec spec) {
        if (spec.usageMessage().exitCodeList().isEmpty()) {
            pw.printf("// tag::picocli-generated-man-section-exit-status[]%n");
            pw.printf("// end::picocli-generated-man-section-exit-status[]%n");
            pw.println();
            return;
        }

Similar issue with commands, arguments and footer, maybe others.

Using picocli 4.6.1 and gradle asciidoctor plugin 3.3.0.

@remkop
Copy link
Owner

remkop commented Mar 4, 2021

Good point, and thank you for providing the #1338 PR! I added some comment on that ticket.

@remkop remkop added this to the 4.6.2 milestone Mar 4, 2021
@remkop remkop added theme: codegen An issue or change related to the picocli-codegen module type: enhancement ✨ labels Mar 4, 2021
@remkop remkop closed this as completed in 9032c04 Mar 4, 2021
MarkoMackic pushed a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
…g WARNING messages when generating man pages"

This reverts commit c84fcde.
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
…g WARNING messages when generating man pages"

This reverts commit c84fcde.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: codegen An issue or change related to the picocli-codegen module type: enhancement ✨
Projects
None yet
Development

No branches or pull requests

2 participants