6 use open OUT => ':encoding(utf-8)', ':std';
12 cat chgrp chmod chown cp date df ln ls mkdir mknod mktemp mv
13 readlink rm rmdir touch uname
16 base64 basename chcon cksum comm csplit cut dircolors
17 dirname du env expand expr factor fmt fold groups head hostid id
18 install join link logname md5sum mkfifo nice nl nohup nproc numfmt od
19 paste pathchk pinky pr printenv printf ptx realpath runcon seq sha1sum
20 shred shuf sort split stat
21 stdbuf sum tac tail tee test timeout tr truncate tsort tty unexpand
22 uniq unlink users wc who whoami yes
25 base32 b2sum sha224sum sha256sum sha384sum sha512sum
28 calendar col column hexdump look ncal
31 find xargs free skill htop uptime watch sed awk perl figlet less
32 curl wget ping fping ssh nc
35 dd pwd sleep stty sync
37 git => [map {"git $_"} qw( log status )],
40 say '# automatically generated by tools/mkclioptions';
43 for my $program (map { $group{$_} ? @{$group{$_}} : $_ } @ARGV) {
46 open my $output, '-|', split(/\h/, $program), '--help';
47 warn "$program exited with status $?\n" if $?;
48 return readline $output;
51 printf "'%s' => {\n", $program;
53 while ($help =~ m{ ^\h+ (-\N*?) (?: \h{3,} (\N*) )? \n }g) {
55 my ($options, $explain) = ($1, $2);
56 $explain =~ s/_\010//g if defined $explain; # underlines in less
57 my ($short) = $options =~ m{ (?<! \H) -([^-]) (?! \w) }
58 or 0 or next; #TODO: option to keep long
59 printf " '%s' => [q{%s}, q{%s}],\n", $short // '', $options, $explain // '';
75 mkclioptions ls >clioptions.inc.pl
79 Mischa POSLAWSKY <perl@shiar.org>
83 Licensed under the GNU Affero General Public License version 3.