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
[[dotfiles.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 }
[[commands.source]]
id = "fig"
kind = "completion"
url = "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts"
license = "MIT"
[[commands.subcommand]]
path = ["api", "go"]
label = "Generate API service code"
description = "Generate Go files for an .api file."
[[commands.subcommand.source]]
id = "fig"
kind = "completion"
url = "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts"
license = "MIT"
[[commands.subcommand.field]]
id = "api"
label = "API file"
type = "path"
option = ["--api"]
path = { kind = "file", role = "input" }
sources = ["fig"]
[[commands.subcommand.field]]
id = "dir"
label = "Target directory"
type = "path"
option = ["--dir"]
path = { kind = "directory", role = "output" }
sources = ["fig"]
[[commands.subcommand.field]]
id = "home"
label = "Template home"
description = "Local template directory; cannot be combined with --remote."
type = "string"
option = ["--home"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "remote"
label = "Template repo"
description = "Remote git repo of the template; wins over --home."
type = "string"
option = ["--remote"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "style"
label = "File naming style"
type = "string"
option = ["--style"]
sources = ["fig"]
[[commands.subcommand.task]]
id = "gen"
label = "Generate"
fields = ["api", "dir", "style"]
required = ["api", "dir"]
[[commands.subcommand.group]]
id = "basic"
label = "Basic"
fields = ["api", "dir", "style"]
[[commands.subcommand.group]]
id = "advanced"
label = "Advanced"
fields = ["home", "remote"]
[[commands.subcommand]]
path = ["api", "format"]
label = "Format API files"
description = "Format .api files in a directory."
[[commands.subcommand.source]]
id = "fig"
kind = "completion"
url = "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts"
license = "MIT"
[[commands.subcommand.field]]
id = "dir"
label = "Directory"
type = "path"
option = ["--dir"]
path = { kind = "directory", role = "input" }
sources = ["fig"]
[[commands.subcommand.field]]
id = "declare"
label = "Skip declared-type check"
type = "boolean"
option = ["--declare"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "iu"
label = "Ignore update"
type = "boolean"
option = ["--iu"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "stdin"
label = "Read from stdin"
type = "boolean"
option = ["--stdin"]
sources = ["fig"]
[[commands.subcommand.task]]
id = "fmt"
label = "Format"
fields = ["dir"]
required = ["dir"]
[[commands.subcommand.group]]
id = "basic"
label = "Basic"
fields = ["dir"]
[[commands.subcommand.group]]
id = "advanced"
label = "Advanced"
fields = ["declare", "iu", "stdin"]
[[commands.subcommand]]
path = ["docker"]
label = "Generate Dockerfile"
description = "Generate a Dockerfile for a Go service."
[[commands.subcommand.source]]
id = "fig"
kind = "completion"
url = "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts"
license = "MIT"
[[commands.subcommand.field]]
id = "go"
label = "Main file"
description = "File that contains the main function."
type = "path"
option = ["--go"]
path = { kind = "file", role = "input" }
sources = ["fig"]
[[commands.subcommand.field]]
id = "base"
label = "Base image"
description = "Defaults to scratch."
type = "string"
option = ["--base"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "port"
label = "Exposed port"
type = "string"
option = ["--port"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "tz"
label = "Timezone"
type = "string"
option = ["--tz"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "version"
label = "Builder Go version"
type = "string"
option = ["--version"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "home"
label = "Template home"
type = "string"
option = ["--home"]
sources = ["fig"]
[[commands.subcommand.task]]
id = "docker"
label = "Dockerfile"
fields = ["go", "base", "port", "tz"]
required = ["go"]
[[commands.subcommand.group]]
id = "basic"
label = "Basic"
fields = ["go", "base", "port"]
[[commands.subcommand.group]]
id = "advanced"
label = "Advanced"
fields = ["version", "home", "tz"]
[[commands.subcommand]]
path = ["model", "mysql", "datasource"]
label = "Generate MySQL model"
description = "Generate model code from a live MySQL data source."
[[commands.subcommand.source]]
id = "fig"
kind = "completion"
url = "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts"
license = "MIT"
[[commands.subcommand.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"]
[[commands.subcommand.field]]
id = "table"
label = "Table pattern"
type = "string"
option = ["--table", "-t"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "dir"
label = "Target directory"
type = "path"
option = ["--dir", "-d"]
path = { kind = "directory", role = "output" }
sources = ["fig"]
[[commands.subcommand.field]]
id = "cache"
label = "With cache"
type = "boolean"
option = ["--cache", "-c"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "style"
label = "File naming style"
type = "string"
option = ["--style"]
sources = ["fig"]
[[commands.subcommand.field]]
id = "idea"
label = "For IDEA plugin"
type = "boolean"
option = ["--idea"]
sources = ["fig"]
[[commands.subcommand.task]]
id = "gen"
label = "Generate model"
fields = ["url", "table", "dir", "cache"]
required = ["url", "table", "dir"]
[[commands.subcommand.group]]
id = "basic"
label = "Basic"
fields = ["url", "table", "dir", "cache"]
[[commands.subcommand.group]]
id = "advanced"
label = "Advanced"
fields = ["style", "idea"]
[[commands.subcommand]]
path = ["quickstart"]
label = "Quick start"
description = "Create and start a sample project."
[[commands.subcommand.source]]
id = "fig"
kind = "completion"
url = "https://github.com/withfig/autocomplete/blob/master/src/goctl.ts"
license = "MIT"
[[commands.subcommand.field]]
id = "service_type"
label = "Service type"
type = "enum"
option = ["--service-type", "-t"]
choices = [{ value = "mono", label = "Monolith" }, { value = "micro", label = "Microservices" }]
sources = ["fig"]
[[commands.subcommand.task]]
id = "quick"
label = "Quick start"
fields = ["service_type"]
required = []
[[commands.subcommand.group]]
id = "basic"
label = "Basic"
fields = ["service_type"]