Open ben-skyportsystems opened 7 years ago
The exact same error also happened to me. Somebody suggested, in a different protoc plugin issue, to explicitly set --plugin
flag as workaround and it seemed to work well for their case, but it didn't work for me when I tried for this protoc-gen-doc case (still return Unknown flag error).
What version of protoc are you on?
@SPSpwetter this is mine :
$ protoc --version
libprotoc 3.1.0
Upgraded to 3.4.0 and now it seems to work (without --plugin
flag), only my custom template still has errors. Thanks!!
Yeah, I thought that might be it. We're on 3.0.0 so we have the same problem. We can generate the non-html off line though until we go all the way to 3.4.
Seems like this works from 3.3.0
forward. If you're unable to bump the protoc version, you could always use the docker container to generate docs.
Does this work for you?
docker run --rm \
-v $(pwd)/doc:/out \
-v $(pwd)/proto:/protos \
pseudomuto/protoc-gen-doc --doc_opt=html,myoutput.html /protos/Customer.proto
Thanks for responding @pseudomuto. We have a bunch of tooling around protoc, so I'm really not able to use the docker solution. Moving protobufs forward would also be a big change that I'm not sure I can bite off at this time. Can you tell me more about what changes in Protobuf 3.3 make this work? Also, what version dependencies do you have on protoc-gen-go, which this seems to piggy-back on top of? Thanks!
I'm trying to get v1.0.0 working together with google/protobuf-gradle-plugin and are struggling also with --doc_opt
.
Apparently, protoc
allows custom options to be passed to the *_out
flag. In turn, the gradle plugin specifically allows to pass custom plugin options to this flag only. See how they are setting up options for the protoc
invokation: GenerateProtoTask.groovy#L324-L328.
Would it be possible to support options prepended to the output argument? Maybe additionally to the --doc_opt
flag?
As I just learnt from google/protobuf-gradle-plugin#184 options can also be passed using the older way of by prepending them to the _out
flag. Accordingly, --doc_out=doc --doc_opt=html,myoutput.html
is equivalent to --doc_out=html,myoutput.html:doc
.
Hi,
I'm trying to use your plugin and can't get it to accept the '--doc_opt' flag. From what I can tell, protoc parses flags as "--foo_arg" and sends "arg" to the plugin "foo", at least that's what I see in other plugins we use (notably protoc-gen-go)
I built the tool as follows:
Are there any steps that I missed in order to enable this flag?
thanks, Ben