[pve-devel] [RFC PATCH common] Use double hyphens when prefixing command options in the documentation

Emmanuel Kasper e.kasper at proxmox.com
Wed Sep 6 14:24:05 CEST 2017


This makes our man pages follow the GNU long option recommandation
where non-single character options are prefixed with a double hyphen.
(https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html)

The benefit for PVE is that our documentation looks more similar to what
a user with previous Linux knowledge is used to.

Our bash autocompletion helper only completes options using double hyphens too.
---
This would require a rebuild of all packages which have a cli handler.
Many examples of the reference documentation use the -- syntax already though,
I would update the remaining if this patch is applied.

 src/PVE/RESTHandler.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
index d700976..07b044d 100644
--- a/src/PVE/RESTHandler.pm
+++ b/src/PVE/RESTHandler.pm
@@ -431,7 +431,7 @@ my $get_property_description = sub {
 	} elsif ($style eq 'config-sub') {
 	    $res .= "`$name`=";
 	} elsif ($style eq 'arg') {
-	    $res .= "`-$name` ";
+	    $res .= "`--$name` ";
 	} elsif ($style eq 'fixed') {
 	    $res .= "`<$name>`: ";
 	} else {
@@ -578,7 +578,7 @@ sub usage_str {
 
 	if (!$prop->{$k}->{optional}) {
 	    $args .= " " if $args;
-	    $args .= "-$base <$type_text>"
+	    $args .= "--$base <$type>"
 	}
     } 
 
-- 
2.11.0





More information about the pve-devel mailing list