Swap CAG with Moo, lazify a lot of the profile selection
[dbsrgits/SQL-Abstract.git] / script / format-sql
1 #!/usr/bin/env perl
2
3 use SQL::Abstract::Tree;
4 use Getopt::Long::Descriptive;
5
6 my ($opt, $usage) = describe_options(
7   'format-sql %o',
8   [ 'profile|p=s',   "the profile to use", { default => 'console' } ],
9   [ 'help',       "print usage message and exit" ],
10 );
11
12   print($usage->text), exit if $opt->help;
13
14 my $sqlat = SQL::Abstract::Tree->new({ profile => $opt->profile, fill_in_placeholders => 0 });
15
16 print $sqlat->format($_) . "\n" while <>;