mix asdf.inspect (asdf v0.1.0)

Copy Markdown View Source

Prints the file-format version, the #ASDF_STANDARD comment, the top-level keys, and each block's sizes.

mix asdf.inspect path/to/file.asdf

The last lines are one compact map. A caller could pass that map to a context tool such as Gnosis. This task does not depend on Gnosis and does not send the map anywhere. Block payloads are not decoded.

Summary

Functions

Prints a summary of the file at path.

Functions

run(arg1)

Prints a summary of the file at path.

args is a one-element list containing the filesystem path. The task prints the format version, the standard version, the top-level keys, and one line per block. The last lines are one compact map. Payloads are not decoded.

Returns :ok after a successful open. Raises Mix.Error when args is not one path, and when ASDF.open/1 returns an error. The error message for a bad argument list is "usage: mix asdf.inspect PATH".

Examples

iex> path = Path.join(System.tmp_dir!(), "asdf-inspect-doctest.asdf")
...> :ok = ASDF.write!(path, %{"hello" => "world"})
...> output = ExUnit.CaptureIO.capture_io(fn -> Mix.Tasks.Asdf.Inspect.run([path]) end)
...> File.rm!(path)
...> String.contains?(output, "format 1.0.0") and String.contains?(output, "hello")
true

iex> try do
...>   Mix.Tasks.Asdf.Inspect.run([])
...> rescue
...>   exception in Mix.Error -> exception.message
...> end
"usage: mix asdf.inspect PATH"