pgFormatter::CLI(3)
π pgFormatter::CLI(3)
okay bestie, welcome to the manual page for pgFormatter::CLI π this is a Perl module β the actual command-line brain of the pg_format program β and trust, it's way less scary than it sounds. pull up a chair, grab a lil snack π, and let's get into it.
β¨ NAME β¨
pgFormatter::CLI β literally the implementation of the command line program that formats SQL queries. that's the whole vibe. π
π VERSION π
Version 5.11 β yes, we're on 5.11, iconic, no notes. β
πΈ SYNOPSIS πΈ
so here's the situation: this module gets called by the pg_format program, but only when it peeks around and realizes it's not being run in a CGI environment. when that happens, all the control over the flow gets passed straight to this module like "here u go bestie, it's yours now" π«Ά. the calling looks like this:
my $program = pgFormatter::CLI->new();
$program->run()
π¦ FUNCTIONS π¦
π new
the object constructor! it does exactly what you think and nothing fancy in here. lowkey the chillest method in the whole file π
π₯ run
this one wraps up all the work related to the pg_format CLI program β main character energy fr fr π. that includes calling the methods to read the command line parameters, validate them, read the query, beautify it, and output. the whole glow-up pipeline, start to finish β¨
π beautify
actually formats the loaded query using the pgFormatter::Beautify library. and if it's necessary? it runs anonymization too π. cute and responsible.
π§ save_output
saves the beautified query to whatever output filehandle is in play. it's giving "deliver the goods" π¦
π logmsg
displays a message, following the log level. simple, effective, slays π
π show_help_and_die
as the name suggests (and honestly, what a name π) β it shows the help page, with an optional error message, and then ends the program. dramatic exit? yes. correct? also yes.
π load_sql
loads the SQL from an input file or from stdin. no cap, that's it πΈ
β get_command_line_args
parses command line options into $self->{'cfg'}. all the flags go in, nice and tidy π§Ί
π«Ά validate_args
validates that the options parsed from the command line have sensible values, and opens the input and output files. the vibe check of the whole operation β π
π AUTHOR π
pgFormatter is an original work from Gilles Darold. give credit where credit is due, periodt π
π BUGS π
please report any bugs or feature requests to: https://github.com/darold/pgFormatter/issues. don't suffer in silence bestie, tell the maintainers π«Ά
π COPYRIGHT π
Copyright 2012-2026 Gilles Darold. All rights reserved.
πΈ LICENSE πΈ
pgFormatter is free software distributed under the PostgreSQL Licence. slay π
also important: a modified version of the SQL::Beautify Perl Module is embedded in pgFormatter with copyright (C) 2009 by Jonas Kramer, and it's published under the terms of the Artistic License 2.0. gotta credit the embedded icon too π
and that's the page!! ty for reading, mwah π β this was perl v5.42.2, dated 2026-09-04, and you just consumed pgFormatter::CLI(3) in full. go format some SQL, you absolute legend πβ¨
π¦ where this page comes from
- arch rolling: pgformatter 5.11-1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms