summaryrefslogtreecommitdiffstats
path: root/doc/genmanpage.pl
blob: 9d33c155b25ef990a3f1f6fe888900c6de4361ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl

use strict;
use warnings;

# Define item leadin/leadout for man output
my $ITEM_LEADIN  = '.IP "\fI';
my $ITEM_LEADOUT = '\fR(1)"';

my $package;
my $description;


# Parse the shortened README file
while (<>) {
    chomp;
    # A line starting with '  -' indicates a script
    if (/^ - ([^:]*): (.*)/) {
        if ($package and $description) {
            # If we get here, then we need to output the man code
            print $ITEM_LEADIN . $package . $ITEM_LEADOUT . "\n";
            print $description . "\n";
        }
        $package     = $1;
        $description = $2;
    } else {
        s/^  //;
        $description .= $_;
    }
}