Skip to content

Provide TSV (tab separated values) output formatter - #88

Merged
Johan Stenberg (ex-msft) (johanste) merged 6 commits into
Azure:masterfrom
johanste:tsvoutputformatter
Mar 30, 2016
Merged

Johan Stenberg (ex-msft) (johanste) merged 6 commits into
Azure:masterfrom
johanste:tsvoutputformatter

Conversation

@johanste

Copy link
Copy Markdown
Contributor

To use, specify --output tsv on the command line.

Behavior:

  • Will print a single tab separated row of output values per result item.
  • Objects of type List will print the number of items in the list
  • Objects of type dict will be printed as {object}
  • Simple value types will be printed

Rationale for implementation per above:

  • In order to be useful, the output needs to have a fixed number of output columns
  • Tab was chosen as separator since it is less likely to occur within a value (no escaping was implemented since that makes both the implementation harder, and - more importantly - consumption of the output significantly harder)

Combined with --query to get properties of nested children.

     --output tsv

It will only print the "top level" simple objects of a given result to avoid issues with variable number of columns/row and/or packing complex types into a single column which would require further parsing to make sense of the data.

One can (for now) use --query to project any properties that one wants to expose.
…"None" whereas dictionary types are completely ignored. All of this can lead to mis-matched columns (unless the caller explicitly splits on \t where they would get empty string values). Addressed by printing '{object}' for dict type values.
… in the JMESPath expression for the --query parameter.

Especially annoying when using the tsv output formatter....
… key name if the dict passed in is not an ordered dict.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant