File: genmanpage.pl

package info (click to toggle)
devscripts 2.25.15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,528 kB
  • sloc: perl: 26,530; sh: 11,698; python: 4,428; makefile: 363
file content (30 lines) | stat: -rwxr-xr-x 665 bytes parent folder | download | duplicates (6)
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 .= $_;
    }
}