]> granicus.if.org Git - curl/commitdiff
gen: support 'redirect'
authorDaniel Stenberg <daniel@haxx.se>
Wed, 16 Nov 2016 09:42:02 +0000 (10:42 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 16 Nov 2016 09:42:50 +0000 (10:42 +0100)
... and warn for too long --help lines

docs/cmdline-opts/MANPAGE.md
docs/cmdline-opts/gen.pl

index 1ba00c83c46ffdfa801a161afc99dee61450c8fa..d9f550f5154c04b8bb0b3731ef998c67f7dcc94a 100644 (file)
@@ -26,6 +26,7 @@ Each file has a set of meta-data and a body of text.
     Mutexed: (space separated list of options this overrides)
     Requires: (space separated list of features this option requires)
     See-also: (space separated list of related options)
+    Redirect: (option name to use instead)
     Help: (short text for the --help output for this option)
     --- (end of meta-data)
 
index 680031003ab3b02eb9320368eb27fcdec295e334..ba405a4a61ed46361f7d7fbe3501edfe53d54576 100755 (executable)
@@ -10,6 +10,7 @@ my %optshort;
 my %optlong;
 my %helplong;
 my %arglong;
+my %redirlong;
 
 # get the long name version, return the man page string
 sub manpageify {
@@ -51,6 +52,7 @@ sub single {
     my $arg;
     my $mutexed;
     my $requires;
+    my $redirect;
     my $seealso;
     my $magic; # cmdline special option
     while(<F>) {
@@ -84,6 +86,9 @@ sub single {
         elsif(/^Requires: (.*)/i) {
             $requires=$1;
         }
+        elsif(/^Redirect: (.*)/i) {
+            $redirect=$1;
+        }
         elsif(/^---/) {
             last;
         }
@@ -109,22 +114,27 @@ sub single {
     }
 
     print ".IP \"$opt\"\n";
-    my $o;
-    if($protocols) {
-        $o++;
-        print "($protocols) ";
-    }
-    if(!$arg && !$mutexed && !$magic) {
-        $o++;
-        print "[Boolean] ";
+    if($redirect) {
+        my $l = manpageify($redirect);
+        print "Use $l instead!\n";
     }
-    if($magic) {
-        $o++;
-        print "[cmdline control] ";
+    else {
+        my $o;
+        if($protocols) {
+            $o++;
+            print "($protocols) ";
+        }
+        if(!$arg && !$mutexed && !$magic) {
+            $o++;
+            print "[Boolean] ";
+        }
+        if($magic) {
+            $o++;
+            print "[cmdline control] ";
+        }
+        print "\n" if($o);
     }
 
-    print "\n" if($o);
-
     printdesc(@desc);
     undef @desc;
 
@@ -231,7 +241,12 @@ sub listhelp {
             $opt .= " $arg";
         }
 
-        printf " %-19s %s\n", $opt, $helplong{$f};
+        my $line = sprintf " %-19s %s\n", $opt, $helplong{$f};
+
+        if(length($line) > 79) {
+            print STDERR "WARN: the --$long line is too long\n";
+        }
+        print $line;
     }
 }