id = "pgformatter" name = "pgFormatter" homepage = "https://github.com/darold/pgFormatter" description = "A PostgreSQL SQL syntax beautifier and formatter." executables = ["pg_format"] [dotfiles] # The official README and CLI source document the home rc file and the XDG # file used by recent releases. A project-local ./.pg_format is intentionally # omitted because it is repository data, not a user-level dotfile. # https://github.com/darold/pgFormatter paths = ["~/.pg_format", "[configHome]/pg_format/pg_format.conf"] secret = [] side_effect = false [commands] format = 1 label = "Format SQL" description = "Beautify one or more SQL files with pg_format. Output goes to stdout unless an output file or in-place is chosen. Placeholders, extra keyword files and HTML output are left out." quality = "ai-draft" parser = { end_of_options = "--", interleave = "permute", long_equals = false, short_attached = true, short_bundles = true } [[commands.source]] id = "help" kind = "manual" url = "https://raw.githubusercontent.com/darold/pgFormatter/master/doc/pg_format.pod" revision = "2026-10-27" evidence = """ Usage: pg_format [options] file.sql file.sql can be a file, multiple files or use - to read query from stdin. -b | --comma-start : in a parameters list, start with the comma (see -e) -f | --function-case N: Change the case of the PostgreSQL functions. Default 2=>uppercase, 3=>capitalize. -i | --inplace : override input files with formatted content. -n | --nocomment : remove any comment from SQL code. -o | --output file : define the filename for the output. Default: stdout. -s | --spaces size : change space indent, default 4 spaces. -T | --tabs : use tabs instead of space characters, when used -u | --keyword-case N : Change the case of the reserved keyword. Default is uppercase: 2. Values: 0=>unchanged, 1=>lowercase, -w | --wrap-limit N : wrap queries at a certain length. -X | --no-rcfile : don't read rc files automatically (./.pg_format or """ [[commands.field]] id = "files" label = "SQL files" description = "Use - to read from stdin." type = "path" path = { kind = "file", role = "input" } position = 0 multiple = true sources = ["help"] [[commands.field]] id = "output" label = "Output file" type = "path" path = { kind = "file", role = "output" } option = ["--output", "-o"] effect = "overwrite" sources = ["help"] [[commands.field]] id = "inplace" label = "Rewrite input files in place" type = "boolean" option = ["--inplace", "-i"] effect = "overwrite" sources = ["help"] [[commands.field]] id = "spaces" label = "Indent width" type = "integer" option = ["--spaces", "-s"] sources = ["help"] [[commands.field]] id = "tabs" label = "Indent with tabs" type = "boolean" option = ["--tabs", "-T"] sources = ["help"] [[commands.field]] id = "keyword_case" label = "Keyword case" type = "enum" option = ["--keyword-case", "-u"] choices = [{ value = "0", label = "Unchanged" }, { value = "1", label = "Lowercase" }, { value = "2", label = "Uppercase" }] sources = ["help"] [[commands.field]] id = "function_case" label = "Function case" type = "enum" option = ["--function-case", "-f"] choices = [{ value = "0", label = "Unchanged" }, { value = "1", label = "Lowercase" }, { value = "2", label = "Uppercase" }, { value = "3", label = "Capitalize" }] sources = ["help"] [[commands.field]] id = "nocomment" label = "Remove comments" type = "boolean" option = ["--nocomment", "-n"] sources = ["help"] [[commands.field]] id = "comma_start" label = "Leading commas" type = "boolean" option = ["--comma-start", "-b"] sources = ["help"] [[commands.field]] id = "wrap_limit" label = "Wrap at column" type = "integer" option = ["--wrap-limit", "-w"] sources = ["help"] [[commands.field]] id = "no_rcfile" label = "Ignore rc files" type = "boolean" option = ["--no-rcfile", "-X"] sources = ["help"] [[commands.task]] id = "format" label = "Format to stdout" fields = ["files", "spaces", "keyword_case"] required = ["files"] [[commands.task]] id = "inplace" label = "Format files in place" fields = ["files", "inplace", "spaces", "keyword_case"] required = ["files", "inplace"] set = { inplace = [true] } [[commands.group]] id = "basic" label = "Basic" fields = ["files", "output", "inplace", "spaces", "tabs", "keyword_case"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["function_case", "nocomment", "comma_start", "wrap_limit", "no_rcfile"]