Skip to content

Output formats for complex types #348

@sergiusens

Description

@sergiusens

Based on #278 and canonical/snapcraft#5060

Overview

Add an emitter method similar to the message method that takes a data structure and outputs it either as a table or as a data structure in a serialization format (MVP: as JSON, but make it expandable)

Acceptance criteria

  • A method on the emitter to write structured data to stdout
    • Output methods (and the ability to make more later):
      • Table (possibly use tabulate, but not required)
      • JSON
  • Example in examples.py that can output in various formats.
  • Example of one Charmcraft command using this for its --format=json arg (does not need to be merged - needs to exist as a manual e2e test before we’ll merge the craft-cli PR)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions