nachricht-nq

Crates.ionachricht-nq
lib.rsnachricht-nq
version0.4.0
sourcesrc
created_at2020-12-22 15:07:30.245786
updated_at2022-03-26 15:57:22.489895
descriptionPretty printing of nachricht messages
homepage
repositoryhttps://github.com/yasammez/nachricht
max_upload_size
id326034
size24,714
Liv Fischer (yasammez)

documentation

https://docs.rs/nachricht-nq

README

nachricht-nq

cargo install nachricht-nq

Transform nachricht messages between the wire format and the textual representation. By default, nq will treat input as binary and generate textual output. This can be used to peek into a program's output with ease.

echo -en "\x82\x01\x02" | nq
[
  true,
  false,
]

The -t switch can be used to treat input as textual form instead. This is useful to format a message on the fly.

echo "[true,false]" | nq -t
(
  true,
  false,
)

The -e switch will produce the output in the wire format. This is useful to canonicalize inefficiently encoded messages or within a pipe to verify the data's validity.

echo -en "\x2f\x00\x00\x00\x00\x00\x00\x00\x02" | nq -e | hexdump -v -e '/1 "%02x "'; echo
22

The two switches can also be combined to generate the wire format from the textual representation. This is useful to quickly feed a nachricht-expecting program some data from the command line.

echo "[true,false]" | nq -te | hexdump -v -e '/1 "%02x "'; echo
82 01 02

Finally, you can edit any nachricht encoded file with the -f <PATH> option. This will open the file in a temporary buffer in your default editor to make changes within the textual representation.

echo -en "\x82\x01\x02" > nachricht.nch
nq -f nachricht.nch
Commit count: 52

cargo fmt