r17624 - in /trunk/libgetopt-euclid-perl: Changes MANIFEST META.yml README debian/changelog debian/control debian/copyright debian/rules debian/watch lib/Getopt/Euclid.pm t/empty_ARGV_array t/entity_angles.t t/minimal.t t/regex_type.t t/simple.t
roberto at users.alioth.debian.org
roberto at users.alioth.debian.org
Sun Mar 16 05:07:05 UTC 2008
Author: roberto
Date: Sun Mar 16 05:07:04 2008
New Revision: 17624
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=17624
Log:
* New upstream release.
* debian/control: Update to Standards-Version 3.7.3 (no changes).
* debian/copyright: Use dist-based URL.
* debian/rules: clean up; remove commented dh_* commands; make directory
removal conditional.
* debian/watch: Use better regex.
Added:
trunk/libgetopt-euclid-perl/t/empty_ARGV_array
- copied unchanged from r17623, branches/upstream/libgetopt-euclid-perl/current/t/empty_ARGV_array
trunk/libgetopt-euclid-perl/t/entity_angles.t
- copied unchanged from r17623, branches/upstream/libgetopt-euclid-perl/current/t/entity_angles.t
Modified:
trunk/libgetopt-euclid-perl/Changes
trunk/libgetopt-euclid-perl/MANIFEST
trunk/libgetopt-euclid-perl/META.yml
trunk/libgetopt-euclid-perl/README
trunk/libgetopt-euclid-perl/debian/changelog
trunk/libgetopt-euclid-perl/debian/control
trunk/libgetopt-euclid-perl/debian/copyright
trunk/libgetopt-euclid-perl/debian/rules
trunk/libgetopt-euclid-perl/debian/watch
trunk/libgetopt-euclid-perl/lib/Getopt/Euclid.pm
trunk/libgetopt-euclid-perl/t/minimal.t
trunk/libgetopt-euclid-perl/t/regex_type.t
trunk/libgetopt-euclid-perl/t/simple.t
Modified: trunk/libgetopt-euclid-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/Changes?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/Changes (original)
+++ trunk/libgetopt-euclid-perl/Changes Sun Mar 16 05:07:04 2008
@@ -83,3 +83,18 @@
- Repatched :vars<opt_> mode to really export all args
(thanks again Tim!)
+
+
+0.2.0 Sat Aug 4 17:22:31 2007
+
+ - Added fallback to $main::VERSION if version not specified in Pod
+ (thanks Todd and Thomas)
+
+ - Added non-zero exit value on bad arg list (thanks Toby)
+
+ - Changed module behaviour: now removes identified arguments from @ARGV.
+ on successful match (thanks Aran and Tim)
+
+ - Allowed alternations everywhere (i.e. outside optionals too)
+
+ - Allowed E<lt> and E<gt> in option specifiers (thanks Wes)
Modified: trunk/libgetopt-euclid-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/MANIFEST?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/MANIFEST (original)
+++ trunk/libgetopt-euclid-perl/MANIFEST Sun Mar 16 05:07:04 2008
@@ -38,3 +38,5 @@
t/fail_misplaced_type.t
t/fail_type_msg.t
t/regex_type.t
+t/empty_ARGV_array
+t/entity_angles.t
Modified: trunk/libgetopt-euclid-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/META.yml?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/META.yml (original)
+++ trunk/libgetopt-euclid-perl/META.yml Sun Mar 16 05:07:04 2008
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Getopt-Euclid
-version: v0.1.0
+version: v0.2.0
version_from: lib/Getopt/Euclid.pm
installdirs: site
requires:
Modified: trunk/libgetopt-euclid-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/README?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/README (original)
+++ trunk/libgetopt-euclid-perl/README Sun Mar 16 05:07:04 2008
@@ -1,4 +1,4 @@
-Getopt::Euclid version 0.1.0
+Getopt::Euclid version 0.2.0
Getopt::Euclid uses your program's own documentation to create a com-
mand-line argument parser. This ensures that your program's documented
Modified: trunk/libgetopt-euclid-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/debian/changelog?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/debian/changelog (original)
+++ trunk/libgetopt-euclid-perl/debian/changelog Sun Mar 16 05:07:04 2008
@@ -1,10 +1,19 @@
-libgetopt-euclid-perl (0.1.0-2) UNRELEASED; urgency=low
+libgetopt-euclid-perl (0.2.0-1) unstable; urgency=low
+ [ Roberto C. Sanchez ]
+ * New upstream release.
+ * debian/control: Update to Standards-Version 3.7.3 (no changes).
+ * debian/copyright: Use dist-based URL.
+ * debian/rules: clean up; remove commented dh_* commands; make directory
+ removal conditional.
+ * debian/watch: Use better regex.
+
+ [ gregor herrmann ]
* debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
field (source stanza); Homepage field (source stanza). Removed: XS-
Vcs-Svn fields.
- -- gregor herrmann <gregor+debian at comodo.priv.at> Tue, 09 Oct 2007 22:29:38 +0200
+ -- Roberto C. Sanchez <roberto at debian.org> Sun, 16 Mar 2008 01:02:13 -0400
libgetopt-euclid-perl (0.1.0-1) unstable; urgency=low
Modified: trunk/libgetopt-euclid-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/debian/control?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/debian/control (original)
+++ trunk/libgetopt-euclid-perl/debian/control Sun Mar 16 05:07:04 2008
@@ -5,7 +5,7 @@
Build-Depends-Indep: perl (>= 5.8.0-7), libversion-perl, libtest-pod-perl, libtest-pod-coverage-perl, libsmart-comments-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Niko Tyni <ntyni at iki.fi>, gregor herrmann <gregor+debian at comodo.priv.at>, Krzysztof Krzyzaniak (eloy) <eloy at debian.org>
-Standards-Version: 3.7.2
+Standards-Version: 3.7.3
Homepage: http://search.cpan.org/dist/Getopt-Euclid/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libgetopt-euclid-perl/
Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/
Modified: trunk/libgetopt-euclid-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/debian/copyright?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/debian/copyright (original)
+++ trunk/libgetopt-euclid-perl/debian/copyright Sun Mar 16 05:07:04 2008
@@ -2,8 +2,7 @@
It was created by Niko Tyni <ntyni at iki.fi> using dh-make-perl on
Thu, 23 Feb 2006 21:41:26 +0200 .
-It was downloaded from
-http://mirrors.kernel.org/CPAN/modules/by-module/Getopt/Getopt-Euclid-v0.0.5.tar.gz
+It was downloaded from http://search.cpan.org/dist/Getopt-Euclid/
Upstream author: Damian Conway <DCONWAY at cpan.org>
Modified: trunk/libgetopt-euclid-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/debian/rules?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/debian/rules (original)
+++ trunk/libgetopt-euclid-perl/debian/rules Sun Mar 16 05:07:04 2008
@@ -54,7 +54,8 @@
# don't install the demo module
$(RM) $(TMP)/usr/share/perl5/Getopt/Euclid/HierDemo.pm \
$(TMP)/usr/share/man/man3/Getopt::Euclid::HierDemo.3pm
- rmdir $(TMP)/usr/share/perl5/Getopt/Euclid
+ [ ! -d $(TMP)/usr/lib/perl5/Getopt/Euclid ] \
+ || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5/Getopt/Euclid
touch install-stamp
@@ -64,10 +65,7 @@
binary-indep: build install
dh_testdir
dh_testroot
-# dh_installcron
-# dh_installmenu
dh_installexamples lib/Getopt/Euclid/HierDemo.pm
-
dh_installdocs
dh_installchangelogs Changes
dh_perl
Modified: trunk/libgetopt-euclid-perl/debian/watch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/debian/watch?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/debian/watch (original)
+++ trunk/libgetopt-euclid-perl/debian/watch Sun Mar 16 05:07:04 2008
@@ -1,3 +1,3 @@
# format version number, currently 3; this line is compulsory!
version=3
-http://www.cpan.org/modules/by-module/Getopt/Getopt-Euclid-v?(\d.*)\.(?:tar\.gz|tar|tgz)
+http://search.cpan.org/dist/Getopt-Euclid/ .*/Getopt-Euclid-v?(\d[\d_.]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)
Modified: trunk/libgetopt-euclid-perl/lib/Getopt/Euclid.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/lib/Getopt/Euclid.pm?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/lib/Getopt/Euclid.pm (original)
+++ trunk/libgetopt-euclid-perl/lib/Getopt/Euclid.pm Sun Mar 16 05:07:04 2008
@@ -1,6 +1,6 @@
package Getopt::Euclid;
-use version; $VERSION = qv('0.1.0');
+use version; $VERSION = qv('0.2.0');
use warnings;
use strict;
@@ -79,6 +79,10 @@
open my $fh, '<', $0
or croak "Getopt::Euclid was unable to access POD\n($!)\nProblem was";
my $source = do{ local $/; <$fh>};
+
+ # Clean up significant entities...
+ $source =~ s{ E<lt> }{<}gxms;
+ $source =~ s{ E<gt> }{>}gxms;
# Set up parsing rules...
my $HWS = qr{ [^\S\n]* }xms;
@@ -115,7 +119,11 @@
my ($prog_name) = (splitpath($0))[-1];
my ($version)
- = $pod =~ m/^=head1 $VERS .*? (\d+(?:[._]\d+)+) .*? $EOHEAD /xms;
+ = $pod =~ m/^=head1 $VERS .*? (\d+(?:[._]\d+)+) .*? $EOHEAD /xms;
+ if ( !defined $version ) {
+ $version = $main::VERSION;
+ }
+
my ($opt_name, $options)
= $pod =~ m/^=head1 ($OPTIONS) (.*?) $EOHEAD /xms;
@@ -259,7 +267,7 @@
}
elsif ($field eq 'type') {
my ($matchtype, $comma, $constraint)
- = $val =~ m/([^,\s]+)\s*(?:(,))?\s*(.*)/xms;
+ = $val =~ m{(/(?:\.|.)+/ | [^,\s]+)\s*(?:(,))?\s*(.*)}xms;
$arg->{var}{$var}{type} = $matchtype;
if ($comma && length $constraint) {
@@ -364,7 +372,7 @@
$msg =~ tr/\0\1/ \t/;
$msg =~ s/\n?\z/\n/xms;
warn "$msg(Try: $prog_name --help)\n\n";
- exit;
+ exit 2; # Traditional "bad arg list" value
};
# Run matcher...
@@ -394,7 +402,9 @@
_verify_args($all_args_ref);
- # Clean up %ARGV...
+ # Clean up @ARGV and %ARGV...
+
+ @ARGV = (); # Everything must have been parsed, so nothign left
for my $arg_name (keys %ARGV) {
# Flatten non-repeatables...
@@ -671,7 +681,9 @@
my $regex = $arg_name;
# Quotemeta specials...
- $regex =~ s{([@#$^*()+{}?|])}{\\$1}gxms;
+ $regex =~ s{([@#$^*()+{}?])}{\\$1}gxms;
+
+ $regex = "(?:$regex)";
# Convert optionals...
1 while $regex =~ s/ \[ ([^]]*) \] /(?:$1)?/gxms;
@@ -743,8 +755,20 @@
exit;
}
+my $OPTIONAL;
+
+BEGIN {
+ $OPTIONAL = qr{ \[ [^[]* (?: (??{$OPTIONAL}) [^[]* )* \] }xms;
+}
+
sub _get_variants {
- my @arg_desc = @_;
+ my @arg_desc = shift =~ m{ [^[|]+ (?: $OPTIONAL [^[|]* )* }gmxs;
+
+ for (@arg_desc) {
+ s{^ \s+ | \s+ $}{}gxms;
+ }
+
+ $DB::single = 1;
# Only consider first "word"...
return $1 if $arg_desc[0] =~ m/\A (< [^>]+ >)/xms;
@@ -760,11 +784,11 @@
if ($arg_desc_without =~ s/ \[ [^][]* \] //xms) {
push @arg_desc, $arg_desc_without;
}
- if ($arg_desc_with =~ m/ \[ ([^][]*) \] /xms) {
+ if ($arg_desc_with =~ m/ [[(] ([^][()]*) [])] /xms) {
my $option = $1;
for my $alternative ( split /\|/, $option ) {
my $arg_desc = $arg_desc_with;
- $arg_desc =~ s{\[ ([^][]*) \]}{$alternative}xms;
+ $arg_desc =~ s{[[(] [^][()]* [])]}{$alternative}xms;
push @arg_desc, $arg_desc;
}
}
@@ -803,7 +827,7 @@
=head1 VERSION
-This document describes Getopt::Euclid version 0.1.0
+This document describes Getopt::Euclid version 0.2.0
=head1 SYNOPSIS
@@ -936,7 +960,7 @@
=item 4.
-parse the contents of C<@ARGV> using that parser, and
+remove the command-line arguments from C<@ARGV> and parse them, and
=item 5.
@@ -1109,14 +1133,13 @@
=item *
-A vertical bar within an optional component indicates an alternative.
-Note that such vertical bars may only appear within square brackets.
+A vertical bar indicates the start of an alternative variant of the argument.
=back
For example, the argument specification:
- =item -i[n] [=] <file>
+ =item -i[n] [=] <file> | --from <file>
indicates that any of the following may appear on the command-line:
@@ -1124,10 +1147,17 @@
-indata.txt -in data.txt -in=data.txt -in = data.txt
+ --from data.text
+
as well as any other combination of whitespacing.
-Any of the above variations would cause both C<$ARGV{'-i'}> and C<$ARGV{'-
-in'}> to be set to the string C<'data.txt'>.
+Any of the above variations would cause all three of:
+
+ $ARGV{'-i'}
+ $ARGV{'-in'}
+ $ARGV{'--from'}
+
+to be set to the string C<'data.txt'>.
You could allow the optional C<=> to also be an optional colon by specifying:
@@ -1757,7 +1787,7 @@
=item Missing required argument(s): %s
-One or more arguments specified in the C<REQUIRED ARGUMENTS> POD section
+At least one argument specified in the C<REQUIRED ARGUMENTS> POD section
wasn't present on the command-line.
@@ -1771,7 +1801,8 @@
=item Unknown argument: %s
Getopt::Euclid didn't recognize an argument you were trying to specify on the
-command-line. This is often caused by command-line typos.
+command-line. This is often caused by command-line typos or an incomplete
+interface specification.
=back
Modified: trunk/libgetopt-euclid-perl/t/minimal.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/t/minimal.t?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/t/minimal.t (original)
+++ trunk/libgetopt-euclid-perl/t/minimal.t Sun Mar 16 05:07:04 2008
@@ -141,7 +141,7 @@
Automaticaly fudge the factors.
=for Euclid:
- false: --no[-fudge]
+ false: [-]-no[-fudge]
=item <step>
Modified: trunk/libgetopt-euclid-perl/t/regex_type.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/t/regex_type.t?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/t/regex_type.t (original)
+++ trunk/libgetopt-euclid-perl/t/regex_type.t Sun Mar 16 05:07:04 2008
@@ -1,6 +1,7 @@
BEGIN {
@ARGV = (
"-h=hostname1234",
+ "-dim=3,4",
);
}
@@ -15,6 +16,7 @@
is $ARGV{'-h'}{dev}, 'hostname' => 'Got expected value for -h <dev>';
is $ARGV{'-h'}{port}, 1234 => 'Got expected value for -h <port>';
+is $ARGV{'-dim'}, '3,4' => 'Got expected value for -dim';
__END__
@@ -39,8 +41,13 @@
Specify device/port
=for Euclid:
- dev.type: /[^:]+\D/
+ dev.type: /[^:\s\d]+\D/
port.type: /\d+/
+
+=item -dim=<dim>
+
+=for Euclid:
+ dim.type: /\d+,\d+/
=back
Modified: trunk/libgetopt-euclid-perl/t/simple.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgetopt-euclid-perl/t/simple.t?rev=17624&op=diff
==============================================================================
--- trunk/libgetopt-euclid-perl/t/simple.t (original)
+++ trunk/libgetopt-euclid-perl/t/simple.t Sun Mar 16 05:07:04 2008
@@ -13,7 +13,7 @@
"size ${H}x${W}",
'-v',
"--timeout $TIMEOUT",
- '-w', 's p a c e s',
+ '--with', 's p a c e s',
7,
);
}
@@ -32,7 +32,7 @@
is $ARGV{$key}, $val, "Got expected value for $key";
}
-is keys %ARGV, 17 => 'Right number of args returned';
+is keys %ARGV, 18 => 'Right number of args returned';
got_arg -i => $INFILE;
got_arg -infile => $INFILE;
@@ -60,7 +60,8 @@
is $ARGV{size}{h}, $H => 'Got expected value for size <h>';
is $ARGV{size}{w}, $W => 'Got expected value for size <w>';
-is $ARGV{-w}, 's p a c e s' => 'Handled spaces correctly';
+is $ARGV{'--with'}, 's p a c e s' => 'Handled spaces correctly';
+is $ARGV{-w}, 's p a c e s' => 'Handled alternation correctly';
is $ARGV{'<step>'}, 7 => 'Handled step size correctly';
@@ -134,7 +135,7 @@
max.type: int
max.default: -1
-=item -w <space>
+=item -w <space> | --with <space>
Test something spaced
More information about the Pkg-perl-cvs-commits
mailing list