| PROTOTEXT(1) | General Commands Manual | PROTOTEXT(1) |
prototext - Lossless protobuf ↔ enhanced-textproto converter
prototext [--descriptor-set] [-o|--output] [-O|--output-root] [-I|--input-root] [-q|--quiet] [-h|--help] [-V|--version] <subcommands>
Lossless protobuf ↔ enhanced-textproto converter
The file may be a raw binary FileDescriptorSet, a #@ prototext-format FileDescriptorSet, or a single FileDescriptorProto. If a sibling <stem>/hopcroft.rkyv file exists it is loaded automatically and enables scoring and auto-inference.
Resolution order: (1) this flag, (2) PROTOTEXT_DESCRIPTOR_SET env var (PROTOTEXT_DEFAULT_DESCRIPTOR accepted with a deprecation warning), (3) built-in google.protobuf.* fallback.
Examples:
# Decode to stdout (schemaless)
prototext decode foo.pb
# Decode with schema; annotations included by default
prototext --descriptor-set my.desc decode --type com.example.Foo foo.pb
# Suppress annotations (protoc-compatible output)
prototext --descriptor-set my.desc decode --type com.example.Foo \
--no-annotations foo.pb
# Identify the schema of an unknown binary
prototext --descriptor-set my.desc list-schemas foo.pb
# Encode prototext back to binary
prototext encode foo.txtpb -o foo.pb
v0.2.0
prototext decode message.binpb
prototext --descriptor-set descriptor.pb decode --type pkg.MyMessage message.binpb
prototext --descriptor-set descriptor.pb decode --type pkg.MyMessage message.binpb
prototext encode message.pb > message.binpb
protoc --encode=pkg.MyMessage descriptor.proto < input.txt | prototext --descriptor-set descriptor.pb decode --type pkg.MyMessage
source <(PROTOTEXT_COMPLETE=bash prototext)
protoc(1)
| prototext | User Commands |