PROTOTEXT(1)
π PROTOTEXT(1) β the manual page, but make it cute π
Okay bestie, welcome to the PROTOTEXT(1) page from the General Commands Manual β this is all about prototext, the Lossless protobuf β enhanced-textproto converter, and it's about to be your new favorite command. No cap. β¨
πΈ NAME πΈ
prototext β Lossless protobuf β enhanced-textproto converter. That's it, that's the name, and honestly it ate. π
β¨ SYNOPSIS β¨
Okay so the whole thing goes like this, don't skip a single bracket bestie:
prototext [--descriptor-set] [-o|--output] [-O|--output-root]
[-I|--input-root] [-q|--quiet] [-h|--help] [-V|--version] <subcommands>
π DESCRIPTION π
Bestie, it's literally the same energy as the NAME: prototext is a Lossless protobuf β enhanced-textproto converter. They really said "if it ain't broke" and honestly? Respect. π But lowkey it's worth repeating because that's the whole entire point β converting between protobuf and enhanced textproto without losing a single thing. Iconic behavior. β¨
π OPTIONS π
--descriptor-set <DESCRIPTOR_SET_FILE>β the FileDescriptorSet for type lookup and scoring, and honestly it's the backbone of the whole schema vibe π
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. That's the magic right there. β¨
Resolution order (iykyk): (1) this flag, (2) the PROTOTEXT_DESCRIPTOR_SET env var β and yes, PROTOTEXT_DEFAULT_DESCRIPTOR is accepted with a deprecation warning, so it's giving "still works but don't @ me" energy π β (3) the built-in google.protobuf.* fallback. May also be specified with the PROTOTEXT_DESCRIPTOR_SET environment variable.
-o,--output <PATH>β write output to PATH, but bestie this is single input only, and it's exclusive with--output-root, so you can't have both, pick a struggle π π-O,--output-root <DIR>β write output files under DIR, mirroring the input tree, which is honestly such a neat vibe π³ (exclusive with--outputand--in-place, so again, choose wisely bestie)-I,--input-root <DIR>β resolve positional paths and globs relative to DIR. And bestie, if you set this and then use an absolute positional path, that's an error, so don't do it. π-q,--quietβ suppress warnings on stderr, because sometimes you just want peace and quiet π€« (errors are always printed though, so you'll never miss those, periodt)-h,--helpβ print help (and you can see a summary with just-h, cute right? π)-V,--versionβ print version. That's it. It's giving minimal but necessary. π
π SUBCOMMANDS π
prototext-decode(1) β decode binary protobuf to prototext, the classic glow-up from binary to readable text π β¨prototext-encode(1) β encode prototext to binary protobuf, the reverse icon behavior, we love a two-way street π«Άprototext-list-schemas(1) β score input(s) against the DB and list candidate types, score-descending. It's giving "who fits this blob best" energy πprototext-score(1) β score input(s) against a known schema type and report the match breakdown, so you get the receipts πprototext-is-canonical(1) β report, per file, whether the blob is canonically encoded (spec 0396): acanonical/anomalousverdict and, when anomalous, each anomaly kind and its count. Exit 0 if all files are canonical, 1 if any is anomalous, 2 on an operational error. The details are detailed, fr fr. πprototext-help(1) β print this message or the help of the given subcommand(s), the "help me help you" of it all π
π EXTRA π
Okay bestie here are the extra examples, and they're giving range:
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
π¦ VERSION π¦
v0.3.6 β that's the version, bestie. It's giving current. π
π§ ENVIRONMENT π§
PROTOTEXT_COMPLETEβ when set tobash,zsh, orfish, it prints a shell completion script to stdout and exits. This is used by the shell completion setup described below, so like, it's the plug for your tab-complete dreams πβ¨PROTOTEXT_GEN_MANβ when set to a directory, it writes this man page there asprototext.1and exits. Meta? Maybe. Iconic? Absolutely. ππ
π EXAMPLES π
Okay bestie, this is the part where we get into the examples, and honestly it's giving tutorial energy. Let's go. π
Decode a binary protobuf file (schemaless) πΈ
prototext decode message.binpb
Decode with a schema π
prototext --descriptor-set descriptor.pb decode --type pkg.MyMessage message.binpb
Decode with inline annotations (on by default; use --no-annotations for clean output) β¨
prototext --descriptor-set descriptor.pb decode --type pkg.MyMessage message.binpb
Encode text back to binary π
prototext encode message.pb > message.binpb
Pipe from protoc π
protoc --encode=pkg.MyMessage descriptor.proto < input.txt | prototext --descriptor-set descriptor.pb decode --type pkg.MyMessage
Decode without annotations but still show unknown fields (default since spec 0103) π¦
prototext --descriptor-set my.desc decode --type pkg.MyMessage --no-annotations message.binpb
Suppress unknown fields for protoc-compatible output π§
prototext --descriptor-set my.desc decode --type pkg.MyMessage --no-annotations --hide-unknown-fields message.binpb
Suppress MessageSet expansion only (Any fields still expand) π
prototext --descriptor-set my.desc decode --type pkg.MyMessage --no-expand-message-set message.binpb
Enable bash completion π
source <(PROTOTEXT_COMPLETE=bash prototext)
π«Ά SEE ALSO π«Ά
protoc(1) β the classic, the OG, the one and only. Check it out if you haven't. π
And that's the whole entire page, bestie. This was prototext, from the User Commands manual, PROTOTEXT(1) edition β catch you in the next one. Mwah. πβ¨
π¦ where this page comes from
- nixpkgs unstable: prototext 0.3.6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms