]>
Commit | Line | Data |
---|---|---|
f4101aa6 AD |
1 | #! /usr/bin/env perl |
2 | ||
3 | use warnings; | |
4 | use 5.005; | |
5 | use strict; | |
6 | ||
7 | my %option; | |
8 | while (<>) | |
9 | { | |
10 | if (/^\s*(?:(-\w), )?(--[-\w]+)(\[?)(=[-\w]+)?\]?/) | |
11 | { | |
12 | my ($short, $long, $opt, $arg) = ($1, $2, $3, $4); | |
13 | $short = defined $short ? '@option{' . $short . '}' : ''; | |
14 | if ($arg) | |
15 | { | |
16 | $arg =~ s/^=//; | |
17 | $arg = '@var{' . lc ($arg) . '}'; | |
18 | $arg = '[' . $arg . ']' | |
19 | if defined $opt; | |
1bb2bd75 | 20 | $option{"$long=$arg"} = $short ? "$short $arg" : ''; |
f4101aa6 AD |
21 | } |
22 | else | |
23 | { | |
24 | $option{"$long"} = "$short"; | |
25 | } | |
26 | } | |
27 | } | |
28 | ||
29 | foreach my $long (sort keys %option) | |
30 | { | |
31 | printf "\@item %-40s \@tab %s\n", '@option{' . $long . '}', $option{$long}; | |
32 | } |