PROTOTEXT(1)

πŸ“¦ version 0.3.6, in nixpkgs unstable

πŸ’… 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 --output and --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): a canonical/anomalous verdict 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 to bash, zsh, or fish, 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 as prototext.1 and 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