{
  "id": "grep",
  "name": "grep",
  "description": "grep prints lines that match a pattern in files or standard input.",
  "executables": [
    "grep"
  ],
  "commands": {
    "format": 1,
    "label": "Search files",
    "description": "Search for a pattern in files or directories. Context, match filtering and file selection options are included; binary-file and device handling are left out.",
    "quality": "ai-draft",
    "base": "fig:grep",
    "parser": {
      "end_of_options": "--",
      "interleave": "permute",
      "long_equals": true,
      "short_attached": true,
      "short_bundles": true
    },
    "source": [
      {
        "id": "fig",
        "kind": "completion",
        "url": "https://github.com/withfig/autocomplete/blob/master/src/grep.ts",
        "license": "MIT"
      }
    ],
    "field": [
      {
        "id": "pattern",
        "label": "Pattern",
        "description": "A basic regular expression unless a pattern-type option is set.",
        "type": "string",
        "position": 0,
        "min": 1,
        "sources": [
          "fig"
        ]
      },
      {
        "id": "paths",
        "label": "Files or directories",
        "description": "Leave empty to read standard input. Directories need Recursive.",
        "type": "path",
        "position": 1,
        "multiple": true,
        "path": {
          "kind": "any",
          "role": "input",
          "must_exist": true
        },
        "sources": [
          "fig"
        ]
      },
      {
        "id": "extended",
        "label": "Extended regex",
        "type": "boolean",
        "option": [
          "-E"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "fixed",
        "label": "Fixed string (no regex)",
        "type": "boolean",
        "option": [
          "-F"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "ignore_case",
        "label": "Ignore case",
        "type": "boolean",
        "option": [
          "-i"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "invert",
        "label": "Invert match",
        "type": "boolean",
        "option": [
          "-v"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "word",
        "label": "Whole words only",
        "type": "boolean",
        "option": [
          "-w"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "recursive",
        "label": "Recursive",
        "type": "boolean",
        "option": [
          "-r"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "line_number",
        "label": "Show line numbers",
        "type": "boolean",
        "option": [
          "-n"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "count",
        "label": "Count matching lines",
        "type": "boolean",
        "option": [
          "-c"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "files_with_matches",
        "label": "List matching files only",
        "type": "boolean",
        "option": [
          "-l"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "only_matching",
        "label": "Print only the matched part",
        "type": "boolean",
        "option": [
          "-o"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "context",
        "label": "Context lines",
        "type": "integer",
        "option": [
          "-C"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "include",
        "label": "Only files matching glob",
        "type": "string",
        "option": [
          "--include"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "exclude",
        "label": "Skip files matching glob",
        "type": "string",
        "option": [
          "--exclude"
        ],
        "sources": [
          "fig"
        ]
      },
      {
        "id": "color",
        "label": "Color",
        "type": "enum",
        "option": [
          "--color"
        ],
        "choices": [
          {
            "value": "auto",
            "label": "Auto"
          },
          {
            "value": "always",
            "label": "Always"
          },
          {
            "value": "never",
            "label": "Never"
          }
        ],
        "sources": [
          "fig"
        ]
      }
    ],
    "task": [
      {
        "id": "search_tree",
        "label": "Search a directory tree",
        "fields": [
          "pattern",
          "paths",
          "recursive",
          "line_number"
        ],
        "required": [
          "pattern",
          "paths"
        ],
        "set": {
          "recursive": [
            true
          ],
          "line_number": [
            true
          ]
        }
      },
      {
        "id": "list_files",
        "label": "List files containing a match",
        "fields": [
          "pattern",
          "paths",
          "recursive",
          "files_with_matches"
        ],
        "required": [
          "pattern",
          "paths"
        ],
        "set": {
          "recursive": [
            true
          ],
          "files_with_matches": [
            true
          ]
        }
      }
    ],
    "group": [
      {
        "id": "basic",
        "label": "Basic",
        "fields": [
          "pattern",
          "paths",
          "recursive",
          "ignore_case",
          "line_number",
          "extended",
          "fixed"
        ]
      },
      {
        "id": "advanced",
        "label": "Advanced",
        "fields": [
          "invert",
          "word",
          "count",
          "files_with_matches",
          "only_matching",
          "context",
          "include",
          "exclude",
          "color"
        ]
      }
    ]
  }
}
