[GH-ISSUE #14] Unified table output #9

Open
opened 2026-02-16 12:57:47 -05:00 by yindo · 5 comments
Owner

Originally created by @root360-AndreasUlm on GitHub (Apr 16, 2019).
Original GitHub issue: https://github.com/go-gitea/tea/issues/14

Hi,

currently every function printing information handles the output format on its own.
That the format cannot be changed easily e.g. in case '\t' is not available (see discussion in #13) and is not unified.

IMHO a central function for handling output in different formats (e.g. table, JSON) would improve the output of all functions to look unified.
The central output functions could handle the delimiter.

A first idea is to add function to pring table based output which gets a dictionary like this:

header:
  - col1
  - col2
  - col3
values:
- 
  - c1val1
  - c2val1
  - c3val1
- 
  - c1val2
  - c2val2
  - c3val2

With this information the table output function can generate a header and print the values.
As all values to be printed are known at this stage the output can even be vertically aligned.

  1. What do you think about this idea?

Regards,
Andreas

Originally created by @root360-AndreasUlm on GitHub (Apr 16, 2019). Original GitHub issue: https://github.com/go-gitea/tea/issues/14 Hi, currently every function printing information handles the output format on its own. That the format cannot be changed easily e.g. in case '\t' is not available (see discussion in #13) and is not unified. IMHO a central function for handling output in different formats (e.g. table, JSON) would improve the output of all functions to look unified. The central output functions could handle the delimiter. A first idea is to add function to pring table based output which gets a dictionary like this: ``` header: - col1 - col2 - col3 values: - - c1val1 - c2val1 - c3val1 - - c1val2 - c2val2 - c3val2 ``` With this information the table output function can generate a header and print the values. As all values to be printed are known at this stage the output can even be vertically aligned. 1) What do you think about this idea? Regards, Andreas
yindo added the enhancement label 2026-02-16 12:57:47 -05:00
Author
Owner

@root360-AndreasUlm commented on GitHub (Apr 25, 2019):

I'm currently implementing the unified output. (https://github.com/root360-AndreasUlm/tea/tree/unified_output_function)
At the moment I'm testing the implementation with all available subcommands.
@lunny When I'm done I'll create PRs for the new functions and every subcommand or should I just create one PR with all changes?

@root360-AndreasUlm commented on GitHub (Apr 25, 2019): I'm currently implementing the unified output. (https://github.com/root360-AndreasUlm/tea/tree/unified_output_function) At the moment I'm testing the implementation with all available subcommands. @lunny When I'm done I'll create PRs for the new functions and every subcommand or should I just create one PR with all changes?
Author
Owner

@lunny commented on GitHub (Apr 25, 2019):

I'm OK. Since the PR title will be unified table output.

@lunny commented on GitHub (Apr 25, 2019): I'm OK. Since the PR title will be unified table output.
Author
Owner

@noerw commented on GitHub (Apr 25, 2019):

IMO, there ideally should be at least one format that is:

  1. easily human readable: grid aligned, always with header
  2. easily human readable & abbreviated: same as 1, but only first X columns, truncated to fit one line
  3. easily machine parseable: CSV/TSV/JSON/YML/..., (in case of CSV never with a header)

That would cover the 3 most common use cases of CLI apps (automation, quick skimming of data, fast access to full data)

@noerw commented on GitHub (Apr 25, 2019): IMO, there ideally should be at least one format that is: 1. easily human readable: grid aligned, always with header 2. easily human readable & abbreviated: same as 1, but only first X columns, truncated to fit one line 3. easily machine parseable: CSV/TSV/JSON/YML/..., (in case of CSV never with a header) That would cover the 3 most common use cases of CLI apps (automation, quick skimming of data, fast access to full data)
Author
Owner

@root360-AndreasUlm commented on GitHub (Apr 28, 2019):

@noerw thanks for the use-cases, I'll implement some of those

@root360-AndreasUlm commented on GitHub (Apr 28, 2019): @noerw thanks for the use-cases, I'll implement some of those
Author
Owner

@root360-AndreasUlm commented on GitHub (Apr 28, 2019):

@lunny finished initial implementation

Out of the cases @noerw mentioned the following are implemented:

  • CSV
  • simple (kind of space-separated values but without headers)
  • table
  • TSV
  • YAML
@root360-AndreasUlm commented on GitHub (Apr 28, 2019): @lunny finished initial implementation Out of the cases @noerw mentioned the following are implemented: - CSV - simple (kind of space-separated values but without headers) - table - TSV - YAML
yindo changed title from Unified table output to [GH-ISSUE #14] Unified table output 2026-06-05 16:34:06 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: go-gitea/tea#9