Skip to content

Commit

Permalink
add xref for subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
crotwell authored and remkop committed Mar 5, 2021
1 parent 0c5a971 commit 45e6869
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,8 @@ static void genCommands(PrintWriter pw, CommandSpec spec) {

Text namesText = subHelp.commandNamesText(", ");
String names = namesText.toString();
pw.printf("%s::%n", names);
String xrefname = makeFileName(subHelp.commandSpec());
pw.printf("xref:%s[%s]::%n", xrefname, names);

CommandLine.Model.UsageMessageSpec usage = subHelp.commandSpec().usageMessage();
String header = !empty(usage.header())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _<file>_::
// tag::picocli-generated-man-section-commands[]
== Commands

*gen-manpage*::
xref:main_class-gen-manpage.adoc[*gen-manpage*]::
Generates man pages for all commands in the specified directory.

// end::picocli-generated-man-section-commands[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Example subcommand
// tag::picocli-generated-man-section-commands[]
== Commands

*gen-manpage*::
xref:top-level-command-subcommand-gen-manpage.adoc[*gen-manpage*]::
Generates man pages for all commands in the specified directory.

// end::picocli-generated-man-section-commands[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ example top-level command
// tag::picocli-generated-man-section-commands[]
== Commands

*subcommand*::
xref:top-level-command-subcommand.adoc[*subcommand*]::
Example subcommand

*visible*::
xref:top-level-command-visible.adoc[*visible*]::
Example visible subcommand

// end::picocli-generated-man-section-commands[]
Expand Down
2 changes: 1 addition & 1 deletion picocli-codegen/src/test/resources/testHidden.manpage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This app does great things.
// tag::picocli-generated-man-section-commands[]
== Commands

*a-sub*::
xref:testHidden-a-sub.adoc[*a-sub*]::
A sub command

// end::picocli-generated-man-section-commands[]
Expand Down

0 comments on commit 45e6869

Please sign in to comment.