Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

table outputs can render as JSON #693

@bryanl

Description

@bryanl

/kind feature

synopsis: ksonnet can render output as a text table. Add the ability to render this as JSON as well.

Why?

ksonnet can interact with other tools in a better fashion if it can output data in an easily parseable format. Bonus points if the format can be applied to multiple types of outputs and can signal the consumer of the incoming contents.

$ ks module list
MODULE
======
/
a
a.b

and as JSON ks module list -o json

{
  "kind": "moduleList",
  "data": [
    {"module": "/"},
    {"module": "a"},
    {"module": "a.b"}
  ]
}

And with more than one column

$ ks component list -o wide 
COMPONENT                         TYPE    APIVERSION   KIND       NAME
=========                         ====    ==========   ====       ====
deployment-nginx-deployment-yrbfz yaml    apps/v1beta1 Deployment nginx-deployment
ds                                jsonnet

and as JSON ks component list -o json

{
  "kind": "componentList",
  "data": [
    {
      "component": "deployment-nginx-deployment-yrbfz",
      "type": "yaml",
      "apiversion": "apps/v1beta",
      "kind": "Deployment",
      "name": "nginx-deployment"
    },
    {
      "component": "ds",
      "type": "jsonnet",
      "apiversion": "",
      "kind": "",
      "name": ""
    }
  ]
} 

Actions with outputs

  • component list
  • env list
  • module list
  • param diff
  • param list
  • pkg list
  • prototype list
  • prototype search
  • registry list

Other actions:

  • annotate JSON with output data type (e.g. {"kind": "componentList": "data": []}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions