WardrikDaemon.CLI.Table (wardrik_daemon v0.1.0-rc.1)

Copy Markdown

Prints rows as columns, each as wide as its widest cell, under a faint header.

Summary

Functions

Prints pairs of a label and a value, one a line. Leaves out those with no value.

Prints rows under header, or empty if there are none. A nil cell is empty.

Writes answer as JSON if the command was given --json. Otherwise prints it as print/4 does.

Functions

pairs(cx, pairs)

@spec pairs(WardrikDaemon.CLI.Context.t(), [{String.t(), term()}]) :: :ok

Prints pairs of a label and a value, one a line. Leaves out those with no value.

print(cx, header, rows, empty)

@spec print(WardrikDaemon.CLI.Context.t(), [String.t()], [[term()]], String.t()) ::
  :ok

Prints rows under header, or empty if there are none. A nil cell is empty.

show(cx, answer, header, rows, empty)

@spec show(
  WardrikDaemon.CLI.Context.t(),
  term(),
  [String.t()],
  [[term()]],
  String.t()
) :: :ok

Writes answer as JSON if the command was given --json. Otherwise prints it as print/4 does.