blob: 2b08fb73f0b8b5cb1c156c1e47e8ba42c8b8d3cb (
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
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
my $man_path = "$ENV{HOME}/packages/feh/man/feh.1";
my $comp_path = "$ENV{HOME}/packages/zsh/etc/completions/_feh";
my @options;
open(my $comp_file, '<', $comp_path) or die("Can't open $comp_path: $!");
while (my $line = <$comp_file>) {
if ($line =~ /^ \t '(?<long> [\w-]+ )' \s+ '(?<short> . ) \+? ' $/xo) {
push(@options, [@+{'short', 'long'}]);
}
elsif ($line =~ /^ \t ' \*? -- (?<long> [\w-]+ ) \[/xo) {
push(@options, [undef, $+{'long'}]);
}
}
close($comp_file);
open(my $man_file, '<', $man_path) or die("Can't open $man_path: $!");
while (my $line = <$man_file>) {
if ($line !~ /^ \.It \s Cm \s (?: -(?<short> . ) \s , )? --(?<long> [\w-]+ )/xo) {
next;
}
if ($+{'long'} =~ / ^ action \d $ /xo) {
next;
}
if (not grep { $_ ~~ [@+{'short', 'long'}] } @options) {
printf("not in completion: %s %s\n",
$+{short} || ' ', $+{long},
);
}
}
close($man_file);
|