Skip to content

Conversation

@zmoog
Copy link
Owner

@zmoog zmoog commented Apr 26, 2022

Motivation

I want a human-friendly table based format for interactive use, and a robot-friendly JSON based format to compose richer workflows with other tools.

$ classeviva grades list --limit 2
+------------+-------+-----------------+-------------------------------+
| DATE       | GRADE | SUBJECT         | NOTES                         |
+------------+-------+-----------------+-------------------------------+
| 2022-05-02 | 7½    | COMPORTAMENTO   | comportamento della settimana |
| 2022-04-27 | 9     | ARTE E IMMAGINE |                               |
+------------+-------+-----------------+-------------------------------+%

Change description

Add a new feedback package copied inspired by the Arduino CLI. Commands can use feedback to send messages and errors to the user. In addition, a PrintResult() is available to print structured result as text, JSON and other potential formats in the future.

Commands can use the Result interface to implement rich formatting of their results.

Reviewer checklist

  • PR address a single concern.
  • PR title and description are appropriately filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.
  • Docs are updated (at least the README.md, if needed).
  • History is clean, commit messages are meaningful (see CONTRIBUTING.md) and are well-formatted.

zmoog added 6 commits April 27, 2022 01:25
Switching to jedib0t/go-pretty library for a new table layout for the
new text output format option.
Adding examples for the new table output and showing the new JSON
output format filter.
@zmoog zmoog self-assigned this May 2, 2022
@zmoog zmoog added the enhancement New feature or request label May 2, 2022
@zmoog zmoog force-pushed the zmoog/more-feedback branch from e05195b to 432e403 Compare May 2, 2022 20:37
Green, red, and blue colours are supported.
@zmoog zmoog marked this pull request as ready for review May 2, 2022 21:51
@zmoog zmoog merged commit 7e8359e into main May 2, 2022
@zmoog zmoog deleted the zmoog/more-feedback branch May 2, 2022 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants