{
  "id": "goctl",
  "name": "goctl",
  "homepage": "https://go-zero.dev/reference/cli-guide/overview/",
  "description": "A go-zero companion code generation tool that integrates Go HTTP, Go gRPC services, database model, k8s, Dockerfile and more.",
  "icon": "https://go-zero.dev/favicon.svg",
  "executables": [
    "goctl"
  ],
  "dotfiles": {
    "paths": [
      "~/.goctl/env"
    ],
    "exclude": [
      "~/.goctl/cache/",
      "~/.goctl/.git/",
      "~/.goctl/.auto_complete/"
    ],
    "secret": [],
    "side_effect": false,
    "machine_lines": [
      {
        "file": "~/.goctl/env",
        "match": {
          "prefix": [
            "GOCTL_HOME",
            "GOCTL_CACHE",
            "GOCTL_OS",
            "GOCTL_ARCH",
            "GOCTL_VERSION",
            "PROTOC_VERSION",
            "PROTOC_GEN_GO_VERSION",
            "PROTO_GEN_GO_GRPC_VERSION"
          ]
        }
      }
    ]
  },
  "commands": {
    "format": 1,
    "label": "go-zero code generation",
    "description": "Generate go-zero API code, Dockerfiles and MySQL models. The rpc, kube, template and migrate commands are left out.",
    "quality": "ai-draft",
    "base": "fig:goctl",
    "parser": {
      "end_of_options": "--",
      "interleave": "permute",
      "long_equals": true,
      "short_attached": true,
      "short_bundles": false
    },
    "source": [
      {
        "id": "fig",
        "kind": "completion",
        "url": "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts",
        "license": "MIT"
      }
    ],
    "subcommand": [
      {
        "path": [
          "api",
          "go"
        ],
        "label": "Generate API service code",
        "description": "Generate Go files for an .api file.",
        "source": [
          {
            "id": "fig",
            "kind": "completion",
            "url": "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts",
            "license": "MIT"
          }
        ],
        "field": [
          {
            "id": "api",
            "label": "API file",
            "type": "path",
            "option": [
              "--api"
            ],
            "path": {
              "kind": "file",
              "role": "input"
            },
            "sources": [
              "fig"
            ]
          },
          {
            "id": "dir",
            "label": "Target directory",
            "type": "path",
            "option": [
              "--dir"
            ],
            "path": {
              "kind": "directory",
              "role": "output"
            },
            "sources": [
              "fig"
            ]
          },
          {
            "id": "home",
            "label": "Template home",
            "description": "Local template directory; cannot be combined with --remote.",
            "type": "string",
            "option": [
              "--home"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "remote",
            "label": "Template repo",
            "description": "Remote git repo of the template; wins over --home.",
            "type": "string",
            "option": [
              "--remote"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "style",
            "label": "File naming style",
            "type": "string",
            "option": [
              "--style"
            ],
            "sources": [
              "fig"
            ]
          }
        ],
        "task": [
          {
            "id": "gen",
            "label": "Generate",
            "fields": [
              "api",
              "dir",
              "style"
            ],
            "required": [
              "api",
              "dir"
            ]
          }
        ],
        "group": [
          {
            "id": "basic",
            "label": "Basic",
            "fields": [
              "api",
              "dir",
              "style"
            ]
          },
          {
            "id": "advanced",
            "label": "Advanced",
            "fields": [
              "home",
              "remote"
            ]
          }
        ]
      },
      {
        "path": [
          "api",
          "format"
        ],
        "label": "Format API files",
        "description": "Format .api files in a directory.",
        "source": [
          {
            "id": "fig",
            "kind": "completion",
            "url": "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts",
            "license": "MIT"
          }
        ],
        "field": [
          {
            "id": "dir",
            "label": "Directory",
            "type": "path",
            "option": [
              "--dir"
            ],
            "path": {
              "kind": "directory",
              "role": "input"
            },
            "sources": [
              "fig"
            ]
          },
          {
            "id": "declare",
            "label": "Skip declared-type check",
            "type": "boolean",
            "option": [
              "--declare"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "iu",
            "label": "Ignore update",
            "type": "boolean",
            "option": [
              "--iu"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "stdin",
            "label": "Read from stdin",
            "type": "boolean",
            "option": [
              "--stdin"
            ],
            "sources": [
              "fig"
            ]
          }
        ],
        "task": [
          {
            "id": "fmt",
            "label": "Format",
            "fields": [
              "dir"
            ],
            "required": [
              "dir"
            ]
          }
        ],
        "group": [
          {
            "id": "basic",
            "label": "Basic",
            "fields": [
              "dir"
            ]
          },
          {
            "id": "advanced",
            "label": "Advanced",
            "fields": [
              "declare",
              "iu",
              "stdin"
            ]
          }
        ]
      },
      {
        "path": [
          "docker"
        ],
        "label": "Generate Dockerfile",
        "description": "Generate a Dockerfile for a Go service.",
        "source": [
          {
            "id": "fig",
            "kind": "completion",
            "url": "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts",
            "license": "MIT"
          }
        ],
        "field": [
          {
            "id": "go",
            "label": "Main file",
            "description": "File that contains the main function.",
            "type": "path",
            "option": [
              "--go"
            ],
            "path": {
              "kind": "file",
              "role": "input"
            },
            "sources": [
              "fig"
            ]
          },
          {
            "id": "base",
            "label": "Base image",
            "description": "Defaults to scratch.",
            "type": "string",
            "option": [
              "--base"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "port",
            "label": "Exposed port",
            "type": "string",
            "option": [
              "--port"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "tz",
            "label": "Timezone",
            "type": "string",
            "option": [
              "--tz"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "version",
            "label": "Builder Go version",
            "type": "string",
            "option": [
              "--version"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "home",
            "label": "Template home",
            "type": "string",
            "option": [
              "--home"
            ],
            "sources": [
              "fig"
            ]
          }
        ],
        "task": [
          {
            "id": "docker",
            "label": "Dockerfile",
            "fields": [
              "go",
              "base",
              "port",
              "tz"
            ],
            "required": [
              "go"
            ]
          }
        ],
        "group": [
          {
            "id": "basic",
            "label": "Basic",
            "fields": [
              "go",
              "base",
              "port"
            ]
          },
          {
            "id": "advanced",
            "label": "Advanced",
            "fields": [
              "version",
              "home",
              "tz"
            ]
          }
        ]
      },
      {
        "path": [
          "model",
          "mysql",
          "datasource"
        ],
        "label": "Generate MySQL model",
        "description": "Generate model code from a live MySQL data source.",
        "source": [
          {
            "id": "fig",
            "kind": "completion",
            "url": "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts",
            "license": "MIT"
          }
        ],
        "field": [
          {
            "id": "url",
            "label": "Data source URL",
            "description": "For example root:password@tcp(127.0.0.1:3306)/database.",
            "type": "string",
            "option": [
              "--url"
            ],
            "sensitive": true,
            "sources": [
              "fig"
            ]
          },
          {
            "id": "table",
            "label": "Table pattern",
            "type": "string",
            "option": [
              "--table",
              "-t"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "dir",
            "label": "Target directory",
            "type": "path",
            "option": [
              "--dir",
              "-d"
            ],
            "path": {
              "kind": "directory",
              "role": "output"
            },
            "sources": [
              "fig"
            ]
          },
          {
            "id": "cache",
            "label": "With cache",
            "type": "boolean",
            "option": [
              "--cache",
              "-c"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "style",
            "label": "File naming style",
            "type": "string",
            "option": [
              "--style"
            ],
            "sources": [
              "fig"
            ]
          },
          {
            "id": "idea",
            "label": "For IDEA plugin",
            "type": "boolean",
            "option": [
              "--idea"
            ],
            "sources": [
              "fig"
            ]
          }
        ],
        "task": [
          {
            "id": "gen",
            "label": "Generate model",
            "fields": [
              "url",
              "table",
              "dir",
              "cache"
            ],
            "required": [
              "url",
              "table",
              "dir"
            ]
          }
        ],
        "group": [
          {
            "id": "basic",
            "label": "Basic",
            "fields": [
              "url",
              "table",
              "dir",
              "cache"
            ]
          },
          {
            "id": "advanced",
            "label": "Advanced",
            "fields": [
              "style",
              "idea"
            ]
          }
        ]
      },
      {
        "path": [
          "quickstart"
        ],
        "label": "Quick start",
        "description": "Create and start a sample project.",
        "source": [
          {
            "id": "fig",
            "kind": "completion",
            "url": "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts",
            "license": "MIT"
          }
        ],
        "field": [
          {
            "id": "service_type",
            "label": "Service type",
            "type": "enum",
            "option": [
              "--service-type",
              "-t"
            ],
            "choices": [
              {
                "value": "mono",
                "label": "Monolith"
              },
              {
                "value": "micro",
                "label": "Microservices"
              }
            ],
            "sources": [
              "fig"
            ]
          }
        ],
        "task": [
          {
            "id": "quick",
            "label": "Quick start",
            "fields": [
              "service_type"
            ],
            "required": []
          }
        ],
        "group": [
          {
            "id": "basic",
            "label": "Basic",
            "fields": [
              "service_type"
            ]
          }
        ]
      }
    ]
  }
}
