{
  "id": "pgformatter",
  "name": "pgFormatter",
  "homepage": "https://github.com/darold/pgFormatter",
  "description": "A PostgreSQL SQL syntax beautifier and formatter.",
  "executables": [
    "pg_format"
  ],
  "dotfiles": {
    "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
    },
    "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\nfile.sql can be a file, multiple files or use - to read query from stdin.\n-b | --comma-start    : in a parameters list, start with the comma (see -e)\n-f | --function-case N: Change the case of the PostgreSQL functions. Default\n2=>uppercase, 3=>capitalize.\n-i | --inplace        : override input files with formatted content.\n-n | --nocomment      : remove any comment from SQL code.\n-o | --output file    : define the filename for the output. Default: stdout.\n-s | --spaces size    : change space indent, default 4 spaces.\n-T | --tabs           : use tabs instead of space characters, when used\n-u | --keyword-case N : Change the case of the reserved keyword. Default is\nuppercase: 2. Values: 0=>unchanged, 1=>lowercase,\n-w | --wrap-limit N   : wrap queries at a certain length.\n-X | --no-rcfile      : don't read rc files automatically (./.pg_format or\n"
      }
    ],
    "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"
        ]
      },
      {
        "id": "output",
        "label": "Output file",
        "type": "path",
        "path": {
          "kind": "file",
          "role": "output"
        },
        "option": [
          "--output",
          "-o"
        ],
        "effect": "overwrite",
        "sources": [
          "help"
        ]
      },
      {
        "id": "inplace",
        "label": "Rewrite input files in place",
        "type": "boolean",
        "option": [
          "--inplace",
          "-i"
        ],
        "effect": "overwrite",
        "sources": [
          "help"
        ]
      },
      {
        "id": "spaces",
        "label": "Indent width",
        "type": "integer",
        "option": [
          "--spaces",
          "-s"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "tabs",
        "label": "Indent with tabs",
        "type": "boolean",
        "option": [
          "--tabs",
          "-T"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "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"
        ]
      },
      {
        "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"
        ]
      },
      {
        "id": "nocomment",
        "label": "Remove comments",
        "type": "boolean",
        "option": [
          "--nocomment",
          "-n"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "comma_start",
        "label": "Leading commas",
        "type": "boolean",
        "option": [
          "--comma-start",
          "-b"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "wrap_limit",
        "label": "Wrap at column",
        "type": "integer",
        "option": [
          "--wrap-limit",
          "-w"
        ],
        "sources": [
          "help"
        ]
      },
      {
        "id": "no_rcfile",
        "label": "Ignore rc files",
        "type": "boolean",
        "option": [
          "--no-rcfile",
          "-X"
        ],
        "sources": [
          "help"
        ]
      }
    ],
    "task": [
      {
        "id": "format",
        "label": "Format to stdout",
        "fields": [
          "files",
          "spaces",
          "keyword_case"
        ],
        "required": [
          "files"
        ]
      },
      {
        "id": "inplace",
        "label": "Format files in place",
        "fields": [
          "files",
          "inplace",
          "spaces",
          "keyword_case"
        ],
        "required": [
          "files",
          "inplace"
        ],
        "set": {
          "inplace": [
            true
          ]
        }
      }
    ],
    "group": [
      {
        "id": "basic",
        "label": "Basic",
        "fields": [
          "files",
          "output",
          "inplace",
          "spaces",
          "tabs",
          "keyword_case"
        ]
      },
      {
        "id": "advanced",
        "label": "Advanced",
        "fields": [
          "function_case",
          "nocomment",
          "comma_start",
          "wrap_limit",
          "no_rcfile"
        ]
      }
    ]
  }
}
