From e13301d07dc117273b10e8f372e3e65ef7349120 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 9 Jul 2010 11:20:11 +0200 Subject: Add scripts/lsopts.pl (list short/long option pairs) --- scripts/lsopts.pl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 scripts/lsopts.pl (limited to 'scripts') diff --git a/scripts/lsopts.pl b/scripts/lsopts.pl new file mode 100755 index 0000000..1ea8aaf --- /dev/null +++ b/scripts/lsopts.pl @@ -0,0 +1,32 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; + +my %opts; + +for my $chr ('a' .. 'z', 'A' .. 'Z') { + $opts{$chr} = q{}; +} + +open(my $fh, '<', 'src/options.c') or die("Can't open options.c: $!"); +while (my $line = <$fh>) { + chomp($line); + if ($line =~ /\{"(?[^"]+)"\s*,.+,.+, (?...)/) { + if (substr($+{'short'}, 0, 1) eq '\'') { + $opts{substr($+{'short'}, 1, 1)} = $+{'long'}; + } + else { + $opts{$+{'short'}} = $+{'long'}; + } + } +} +close($fh); + +foreach my $short (sort keys %opts) { + printf( + "%s\t%s\n", + $short, + $opts{$short}, + ); +} -- cgit v1.2.3