2026-09-22 21:15:07 +02:00
|
|
|
.TH INTERPRES-DECODE 1 "2026-09-22" "interpres 2.0.0" "User Commands"
|
2026-09-22 00:55:02 +02:00
|
|
|
.SH NAME
|
|
|
|
|
interpres-decode \- TOML validator and toml-test harness adapter
|
|
|
|
|
.SH SYNOPSIS
|
|
|
|
|
.B interpres-decode
|
|
|
|
|
[\fIFLAGS\fR]
|
|
|
|
|
.br
|
|
|
|
|
.B interpres-decode
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-encode
|
2026-09-22 00:55:02 +02:00
|
|
|
.br
|
|
|
|
|
.B interpres-decode
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-validate
|
2026-09-22 00:55:02 +02:00
|
|
|
[\fIFILE\fR...]
|
|
|
|
|
.br
|
|
|
|
|
.B interpres-decode
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-validate
|
2026-09-22 00:55:02 +02:00
|
|
|
[\fIDIRECTORY\fR...]
|
|
|
|
|
.br
|
|
|
|
|
.B interpres-decode
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-json
|
2026-09-22 00:55:02 +02:00
|
|
|
.br
|
|
|
|
|
.B interpres-decode
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-struct
|
2026-09-22 00:55:02 +02:00
|
|
|
.br
|
|
|
|
|
.B interpres-decode
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-schema
|
2026-09-22 00:55:02 +02:00
|
|
|
\fITYPE\fR
|
|
|
|
|
\fIFILE.go\fR
|
|
|
|
|
.br
|
|
|
|
|
.B interpres-decode
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-version
|
2026-09-22 00:55:02 +02:00
|
|
|
.SH DESCRIPTION
|
|
|
|
|
.B interpres-decode
|
|
|
|
|
is the toml-test harness adapter in both directions and a TOML validator.
|
|
|
|
|
Without a mode flag it reads one TOML document from standard input and writes
|
|
|
|
|
the toml-test tagged-JSON representation to standard output.
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-encode
|
2026-09-22 00:55:02 +02:00
|
|
|
reads a tagged-JSON description from standard input and writes the TOML
|
|
|
|
|
document it describes.
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-validate
|
2026-09-22 00:55:02 +02:00
|
|
|
parses each named file, or standard input when none are named, and prints one
|
|
|
|
|
line per invalid document to standard error; a named directory is walked for
|
|
|
|
|
.B .toml
|
|
|
|
|
files, every one validated, and the walk closes with a summary on standard
|
|
|
|
|
error naming the counts. The name
|
|
|
|
|
.B \-
|
|
|
|
|
means standard input.
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-json
|
|
|
|
|
prints plain indented JSON instead of the tagged form; it shapes the decoding
|
|
|
|
|
output only, so it is rejected together with the mode flags.
|
|
|
|
|
.B \-\-struct
|
2026-09-22 00:55:02 +02:00
|
|
|
prints a Go struct definition inferred from the document on standard input.
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-schema
|
2026-09-22 00:55:02 +02:00
|
|
|
writes a TOML template for the struct type
|
|
|
|
|
\fITYPE\fR
|
|
|
|
|
declared in the Go source file
|
|
|
|
|
\fIFILE.go\fR,
|
|
|
|
|
taking the key names, comments and defaults from the fields' tags.
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-version
|
2026-09-22 00:55:02 +02:00
|
|
|
prints the binary's version and exits.
|
|
|
|
|
.PP
|
|
|
|
|
The mode flags
|
2026-09-22 21:15:07 +02:00
|
|
|
.BR \-\-validate ,
|
|
|
|
|
.BR \-\-encode ,
|
|
|
|
|
.B \-\-struct
|
2026-09-22 00:55:02 +02:00
|
|
|
and
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-schema
|
2026-09-22 00:55:02 +02:00
|
|
|
cannot be combined.
|
|
|
|
|
.SH OPTIONS
|
|
|
|
|
.TP
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-validate
|
2026-09-22 00:55:02 +02:00
|
|
|
Validate the documents instead of emitting tagged JSON.
|
|
|
|
|
.TP
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-encode
|
2026-09-22 00:55:02 +02:00
|
|
|
Read tagged JSON from standard input and write TOML instead.
|
|
|
|
|
.TP
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-json
|
2026-09-22 00:55:02 +02:00
|
|
|
With the default mode, print plain indented JSON instead of tagged JSON.
|
|
|
|
|
.TP
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-struct
|
2026-09-22 00:55:02 +02:00
|
|
|
Infer a Go struct definition from the document on standard input and print it.
|
|
|
|
|
.TP
|
2026-09-22 21:15:07 +02:00
|
|
|
.BI \-\-schema " TYPE"
|
2026-09-22 00:55:02 +02:00
|
|
|
Write a TOML template for the struct type \fITYPE\fR; the Go source file
|
|
|
|
|
follows as the first argument.
|
|
|
|
|
.TP
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-version
|
2026-09-22 00:55:02 +02:00
|
|
|
Print the version and exit.
|
|
|
|
|
.TP
|
2026-09-22 21:15:07 +02:00
|
|
|
.B \-\-help
|
2026-09-22 00:55:02 +02:00
|
|
|
Print the usage.
|
|
|
|
|
.SH EXIT STATUS
|
|
|
|
|
.TP
|
|
|
|
|
.B 0
|
|
|
|
|
The document parsed and the output was written; in validate mode, every
|
|
|
|
|
document parsed.
|
|
|
|
|
.TP
|
|
|
|
|
.B 1
|
2026-09-22 21:15:07 +02:00
|
|
|
Adapter: a parse error. Validate: at least one document is invalid. Struct:
|
|
|
|
|
the document on standard input failed to parse.
|
2026-09-22 00:55:02 +02:00
|
|
|
.TP
|
|
|
|
|
.B 2
|
2026-09-22 21:15:07 +02:00
|
|
|
A usage error, a read or write failure, malformed tagged JSON, or a value
|
|
|
|
|
with no TOML representation.
|
2026-09-22 00:55:02 +02:00
|
|
|
.SH EXAMPLES
|
|
|
|
|
Decode a document into tagged JSON:
|
|
|
|
|
.PP
|
|
|
|
|
.nf
|
|
|
|
|
.RS
|
|
|
|
|
echo 'title = "hello"' | interpres-decode
|
|
|
|
|
.RE
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
Validate a directory of configuration, with the summary:
|
|
|
|
|
.PP
|
|
|
|
|
.nf
|
|
|
|
|
.RS
|
2026-09-22 21:15:07 +02:00
|
|
|
interpres-decode \-\-validate configs/
|
2026-09-22 00:55:02 +02:00
|
|
|
.RE
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
Infer a Go type from a document:
|
|
|
|
|
.PP
|
|
|
|
|
.nf
|
|
|
|
|
.RS
|
2026-09-22 21:15:07 +02:00
|
|
|
interpres-decode \-\-struct < config.toml > config.go
|
2026-09-22 00:55:02 +02:00
|
|
|
.RE
|
|
|
|
|
.fi
|
|
|
|
|
.PP
|
|
|
|
|
Write the template back from the type:
|
|
|
|
|
.PP
|
|
|
|
|
.nf
|
|
|
|
|
.RS
|
2026-09-22 21:15:07 +02:00
|
|
|
interpres-decode \-\-schema Config config.go
|
2026-09-22 00:55:02 +02:00
|
|
|
.RE
|
|
|
|
|
.fi
|
|
|
|
|
.SH SEE ALSO
|
|
|
|
|
The repository's
|
|
|
|
|
.B docs/CLI.md
|
|
|
|
|
carries the full reference, including the tagged-JSON wire format.
|