First part of fixing #6656 [0]. The `cli_` prefix here is chosen to make them unambiguous.
For example, anchors for subsections in the QEMU top-level section are named `qm_<something>`, which could potentially introduce conflicts without the prefix. [0] https://bugzilla.proxmox.com/show_bug.cgi?id=6656 Signed-off-by: Christoph Heiss <c.he...@proxmox.com> --- src/PVE/CLIHandler.pm | 9 ++++++--- src/PVE/RESTHandler.pm | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 82118a8..89cb7b7 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -233,7 +233,9 @@ sub generate_usage_str { $oldclass = $class; } elsif (defined($def->{$cmd}->{alias}) && ($format eq 'asciidoc')) { - + my $safeprefix = $prefix =~ s/\s/_/rg; + my $safecmd = $cmd =~ s/\s/_/rg; + $str .= "[[cli_${safeprefix}_${safecmd}]]\n"; $str .= "*$prefix $cmd*\n\nAn alias for '$prefix $def->{$cmd}->{alias}'.\n\n"; @@ -336,7 +338,8 @@ __PACKAGE__->register_method({ sub print_simple_asciidoc_synopsis { $assert_initialized->(); - my $synopsis = "*${exename}* `help`\n\n"; + my $synopsis = "[[cli_${exename}_help]]\n"; + $synopsis .= "*${exename}* `help`\n\n"; $synopsis .= generate_usage_str('asciidoc'); return $synopsis; @@ -345,7 +348,7 @@ sub print_simple_asciidoc_synopsis { sub print_asciidoc_synopsis { $assert_initialized->(); - my $synopsis = ""; + my $synopsis = "[[cli_${exename}]]\n"; $synopsis .= "*${exename}* `<COMMAND> [ARGS] [OPTIONS]`\n\n"; diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index 4c31ea1..82e6db5 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -820,6 +820,8 @@ sub getopt_usage { } if ($format eq 'asciidoc') { + my $safeprefix = $prefix =~ s/\s/_/rg; + $out .= "[[cli_${safeprefix}]]\n"; $out .= "*${prefix}*"; $out .= " `$args`" if $args; $out .= " `[OPTIONS]`" if $opts; -- 2.50.1 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel