X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=script%2Fformat-sql;h=6254e8360c3e4518d3d2a3e6e8a308f7b66e7373;hb=48d9f5f846e7f9e8f51110ad418a3bb4b50c31f9;hp=86d008b9f507ea3b680f2574e8ac8a604cfcdd2b;hpb=2005eba8e5ebbeb2855d01686888ecf60fe6cc68;p=dbsrgits%2FSQL-Abstract.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 <>;