pgFormatter::CLI(3)

πŸ“¦
version 5.11 Β· 2 versions
, in nixpkgs unstable

πŸ’– pgFormatter::CLI πŸ’–

okay bestie, welcome to the manual page for pgFormatter::CLI β€” yes, the User Contributed Perl Documentation one, and the manual name is literally pgFormatter::CLI(3), so you know exactly where you are πŸ’…βœ¨


🌸 NAME 🌸

pgFormatter::CLI β€” it's the implementation of the command line program that formats SQL queries. That's the whole assignment: SQL queries get formatted, and this module is the CLI implementation doing it πŸ’–


πŸŽ€ VERSION πŸŽ€

Version 5.11 β€” periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

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

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

✨ FUNCTIONS ✨

πŸ’– new πŸ’–

It's the object constructor, and there is nothing fancy in here β€” lowkey simple, highkey essential 🫢

πŸ’– run πŸ’–

Wraps all work related to the pg_format CLI program. This includes calling methods to read command line parameters, validate them, read query, beautify it, and output. Basically it's the main character of the CLI flow πŸ‘‘

πŸ’– beautify πŸ’–

Actually formats loaded query using the pgFormatter::Beautify library. If necessary, it runs anonymization. So yes, it's giving "make the SQL pretty" energy, with a little anonymous glow-up when needed 🌈

πŸ’– save_output πŸ’–

Saves beautified query to whatever is output filehandle. That filehandle? Whoever it is, it's getting the formatted query πŸŽ€

πŸ’– logmsg πŸ’–

Display message following the log level. Logging but make it on brand πŸ’¬

πŸ’– show_help_and_die πŸ’–

As name suggests β€” shows help page, with optional error message, and ends program. Dramatic exit? Maybe. Helpful exit? Absolutely πŸ’…

πŸ’– load_sql πŸ’–

Loads SQL from input file or stdin. SQL comes from somewhere, and this function is the one handling it πŸ¦‹

πŸ’– get_command_line_args πŸ’–

Parses command line options into $self->{'cfg'}. All the CLI args get parsed into that config hash, no cap ✨

πŸ’– validate_args πŸ’–

Validates that options parsed from command line have sensible values, opens input and output files. It's the vibe check for your arguments and your filehandles πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

pgFormatter is an original work from Gilles Darold. Iconic behavior, honestly πŸ’œ


πŸ’€ BUGS πŸ’€

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

Bestie, if something is broken, take it to the issues page β€” that's the move πŸ™ˆ


Copyright 2012-2026 Gilles Darold. All rights reserved. Respect the copyright, periodt πŸŽ€


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

Two licenses, two icons, one very legal little moment πŸ’…βœ¨


okay that's the whole page bestie 🫢 the footer says perl v5.42.3, dated 1980-01-01, and it's the manual for pgFormatter::CLI(3) β€” bye! πŸ’–πŸŽ€
πŸ“¦ where this page comes from