#!/usr/bin/env perl use 5.014; use warnings; use utf8; use re '/msx'; use open OUT => ':utf8', ':std'; our $VERSION = '1.00'; say '# automatically generated by tools/mkclioptions'; say '+{'; for my $program (@ARGV) { my $help = eval { local $/; open my $output, '-|', $program, '--help'; return readline $output; } or next; printf "%s => {\n", $program; while ($help =~ m{ ^\h+ (-\N*?) (?: \h{3,} (\N*) )? \n }g) { #TODO: continuations my ($options, $explain) = ($1, $2); my ($short) = $options =~ m{ (?clioptions.inc.pl =head1 AUTHOR Mischa POSLAWSKY =head1 LICENSE Licensed under the GNU Affero General Public License version 3.