6 use open OUT => ':utf8', ':std';
10 say '# automatically generated by tools/mkclioptions';
13 for my $program (@ARGV) {
16 open my $output, '-|', $program, '--help';
17 return readline $output;
20 printf "%s => {\n", $program;
22 while ($help =~ m{ ^\h+ (-\N*?) (?: \h{3,} (\N*) )? \n }g) {
24 my ($options, $explain) = ($1, $2);
25 my ($short) = $options =~ m{ (?<! \H) -([^-]) (?! [^,\h]) }
27 printf " ['%s', '%s', q{%s}]\n", $short, $options, $explain // '';
43 mkclioptions ls >clioptions.inc.pl
47 Mischa POSLAWSKY <perl@shiar.org>
51 Licensed under the GNU Affero General Public License version 3.