logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

pgFormatter::CLI - Implementation of command line program to format SQL queries.

Author

       pgFormatter is an original work from Gilles Darold

Bugs

       Please report any bugs or feature requests to: https://github.com/darold/pgFormatter/issues

Functions

new
       Object constructor, nothing fancy in here.

   run
       Wraps all work related to pg_format CLI program. This includes calling methods to read command line
       parameters, validate them, read query, beautify it, and output.

   beautify
       Actually formats loaded query using pgFormatter::Beautify library. If necessary runs anonymization.

   save_output
       Saves beautified query to whatever is output filehandle

   logmsg
       Display message following the log level

   show_help_and_die
       As name suggests - shows help page, with optional error message, and ends program.

   load_sql
       Loads SQL from input file or stdin.

   get_command_line_args
       Parses command line options into $self->{'cfg'}.

   validate_args
       Validates that options parsed from command line have sensible values, opens input and output files.

License

       pgFormatter is free software distributed under the PostgreSQL Licence.

       A modified version of the SQL::Beautify Perl Module is embedded in pgFormatter with copyright (C) 2009 by
       Jonas Kramer and is published under the terms of the Artistic License 2.0.

perl v5.40.1                                       2025-03-18                              pgFormatter::CLI(3pm)

Name

       pgFormatter::CLI - Implementation of command line program to format SQL queries.

Synopsis

       This module is called by pg_format program, when it detects it is not being run in CGI environment. In
       such case all control over flow is passed to this module by calling:

           my $program = pgFormatter::CLI->new();
           $program->run()

Version

       Version 5.6

See Also