-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathcrank-mutex
More file actions
executable file
·65 lines (54 loc) · 2.1 KB
/
Copy pathcrank-mutex
File metadata and controls
executable file
·65 lines (54 loc) · 2.1 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/env perl
use 5.010;
use strict;
use warnings;
use Data::Dumper 2.160; # For the TrailingComma option.
sub invalid_combinations {
my @context = qw( -A -B -C -p );
my @pretty = qw( --heading --group --break );
my @filename = qw( -h -H --with-filename --no-filename );
my @file_lists = qw( -f -g -l -L );
my @output = qw( -o --output );
my @fg = qw( -f -g );
return (
[qw(-l)] => [@context, @file_lists, @pretty, @filename, @output, qw(--passthru --column --show-types)],
[qw(-L)] => [@context, @file_lists, @pretty, @filename, @output, qw(--passthru --column --show-types -c -v)],
[@output] => [@context, @file_lists, @output, qw(-c --column --show-types)],
[qw(--passthru)] => [@context, @file_lists, @output, qw(-c --column -m -1 -v)],
[qw(--match)] => [qw(-f -g)],
[qw(-m)] => [@fg, qw(-1 -c)],
[qw(-h)] => [@file_lists],
[qw(-H)] => [@file_lists],
[qw(-c)] => [@context, @pretty, @fg, qw(--column)],
[qw(--column)] => [@file_lists, qw(--no-lineno)],
[@context] => [@file_lists],
[qw(-f)] => [qw(-v)],
[@fg] => [@fg, @pretty, qw(-x -c -u --files-from)],
[qw(-p)] => [@context, @file_lists, qw(--passthru -c)],
[qw(-v)] => [qw(--column -o --output --passthru)],
[qw(-u)] => [@fg, qw(--output)],
[qw(-x)] => [qw( --files-from )],
);
}
my %mutex;
my @combos = invalid_combinations();
while ( my ($lefts,$rights) = splice( @combos, 0, 2 ) ) {
for my $left ( @{$lefts} ) {
$left =~ s/^-+//;
for my $right ( @{$rights} ) {
$right =~ s/^-+//;
$mutex{$left}->{$right} = 1;
$mutex{$right}->{$left} = 1;
}
}
}
$Data::Dumper::Indent = 1;
$Data::Dumper::Trailingcomma = 1;
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Quotekeys = 0;
my $out = Dumper( \%mutex );
$out =~ s/ / /g;
$out =~ s/^/ /gsm; # Indent a tabstop
$out =~ s/\$VAR1 =/return/sm;
say $out;
exit 0;