X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=script%2Fformat-sql;h=6254e8360c3e4518d3d2a3e6e8a308f7b66e7373;hb=ffce8d5f88fbf0542c9a2667e1df52ef0408431d;hp=86d008b9f507ea3b680f2574e8ac8a604cfcdd2b;hpb=f8e09b24e17bf4d16ef9c3a3a0a6f33e901fa6a8;p=scpubgit%2FQ-Branch.git diff --git a/script/format-sql b/script/format-sql index 86d008b..6254e83 100755 --- a/script/format-sql +++ b/script/format-sql @@ -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 <>;