[Bast-commits] r9751 - in SQL-Abstract/1.x/trunk: . script
frew at dev.catalyst.perl.org
frew at dev.catalyst.perl.org
Sat Oct 9 08:26:07 GMT 2010
Author: frew
Date: 2010-10-09 09:26:07 +0100 (Sat, 09 Oct 2010)
New Revision: 9751
Modified:
SQL-Abstract/1.x/trunk/Makefile.PL
SQL-Abstract/1.x/trunk/script/format-sql
Log:
make format-sql actually useful
Modified: SQL-Abstract/1.x/trunk/Makefile.PL
===================================================================
--- SQL-Abstract/1.x/trunk/Makefile.PL 2010-10-09 07:57:12 UTC (rev 9750)
+++ SQL-Abstract/1.x/trunk/Makefile.PL 2010-10-09 08:26:07 UTC (rev 9751)
@@ -13,6 +13,7 @@
requires 'List::Util' => 0;
requires 'Scalar::Util' => 0;
requires 'Class::Accessor::Grouped' => 0.09005;
+requires 'Getopt::Long::Descriptive' => 0.086;
requires 'Hash::Merge' => 0.12;
test_requires "Test::More" => 0.92;
@@ -24,6 +25,8 @@
no_index package => 'DBIx::Class::Storage::Debug::PrettyPrint';
no_index directory => 'examples';
+install_script 'format-sql';
+
tests_recursive 't';
WriteAll();
Modified: SQL-Abstract/1.x/trunk/script/format-sql
===================================================================
--- SQL-Abstract/1.x/trunk/script/format-sql 2010-10-09 07:57:12 UTC (rev 9750)
+++ SQL-Abstract/1.x/trunk/script/format-sql 2010-10-09 08:26:07 UTC (rev 9751)
@@ -1,7 +1,16 @@
#!/usr/bin/env perl
use SQL::Abstract::Tree;
+use Getopt::Long::Descriptive;
-my $sqlat = SQL::Abstract::Tree->new({ profile => 'console' });
+my ($opt, $usage) = describe_options(
+ 'format-sql %o',
+ [ 'profile|p=s', "the profile to use", { default => 'console' } ],
+ [ 'help', "print usage message and exit" ],
+);
+ print($usage->text), exit if $opt->help;
+
+my $sqlat = SQL::Abstract::Tree->new({ profile => $opt->profile });
+
print $sqlat->format($_) . "\n" while <>;
More information about the Bast-commits
mailing list