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 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