Skip to content

Make return values more readable by default #379

@JoshMock

Description

@JoshMock

There are many commands whose output is simple and small, where text output would typically be expected unless --json is applied. For example, right now, elastic version returns JSON by default, which is unexpected at best:

❯ elastic version
{
  "version": "0.2.1"
}

Requirements

  1. Audit all commands that will always have a simple output, and evaluate what their default output is when --json is not used.
  2. Ensure the output is rendered in a way that is pleasing to the eye when printing to an interactive TTY using colors, bold, table borders, etc, and in easily-parsed tabular format when piped to another process

"Simple" is a blurry boundary, but typically anything that could easily be printed as tabular data (array of strings; array of flat, homogeneous objects) or a single value should be printed in a way that's pleasing to the eye and easy to pipe into other Unix commands that expect plaintext input.

Currently src/output.ts is responsible for handling some of this, but the CLI has evolved quite a bit since it was implemented, so it may not be working as effectively as it could be. I'd start investigation there when establishing a plan of attack.

The ultimate goal of this effort is ensuring human-readable outputs are likeable, pleasant to read, and send the message that the CLI is not just for agents. 🖤

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions