Skip to content

Releases: tetratelabs/protoc-gen-cobra

MVP

10 Oct 19:06
a4b0863
Compare
Choose a tag to compare
MVP Pre-release
Pre-release

PoC version of protoc-gen-cobra which successfully generates CLIs for the entirety of Tetrate's API suite. Above and beyond upstream, the code that is generated is a little cleaner and avoids init, and we generate flags for each command based on the fields of the request object:

protoc-gen-cobra/example$ go run main.go cache set --help
Set client; call by piping a request in to stdin (--stdin), reading a file (--file), or via flags per field

Usage:
  example cache set [flags]

Examples:
TODO: print protobuf method comments here

Flags:
  -h, --help           help for set
      --key string     get-comment-from-proto
      --value string   get-comment-from-proto

Global Flags:
      --auth-token string          authorization token
      --auth-token-type string     authorization token type (default "Bearer")
      --config string              config file (default is $HOME/.example.yaml)
      --jwt-key string             jwt key
      --jwt-key-file string        jwt key file
  -p, --print-sample-request       print sample request file and exit
  -f, --request-file string        client request file (must be json, yaml, or xml); use "-" for stdin + json
  -o, --response-format string     response format (json, prettyjson, yaml, or xml) (default "json")
  -s, --server-addr string         server address in form of host:port (default "localhost:8080")
      --stdin                      read client request from STDIN; alternative for '-f -'
      --timeout duration           client connection timeout (default 10s)
      --tls                        enable tls
      --tls-ca-cert-file string    ca certificate file
      --tls-cert-file string       client certificate file
      --tls-insecure-skip-verify   INSECURE: skip tls checks
      --tls-key-file string        client key file
      --tls-server-name string     tls server name override