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

FileDescriptorSet for type lookup and scoring.

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.

May also be specified with the PROTOTEXT_DESCRIPTOR_SET environment variable.
Write output to PATH (single input only; exclusive with --output-root)
Write output files under DIR, mirroring the input tree (exclusive with --output and --in-place)
Resolve positional paths and globs relative to DIR. Absolute positional paths are an error when set
Suppress warnings on stderr (errors are always printed)
Print help (see a summary with '-h')
Print version

Decode binary protobuf to prototext
Encode prototext to binary protobuf
Score input(s) against the DB and list candidate types, score-descending
Score input(s) against a known schema type and report the match breakdown
Print this message or the help of the given subcommand(s)

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

When set to bash, zsh, or fish, print a shell completion script to stdout and exit. Used by the shell completion setup described below.

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