Conversation
evankanderson
left a comment
There was a problem hiding this comment.
Thanks for looking at this! A few questions, but the new output doesn't look worse than the old (I don't have a strong opinion as to whether or not it's better, except that it seems like history list may have less data than before).
|
Regarding the history list output I have verified this locally against the previous version, no data is being getting modified Previously my approach based on a central columnSpecs map. This required manual updates every time a new command or header was added. My new approach uses updateWidths to track the actual maxColWidths of the data being injected. Removed borders in table For Profile tables , I've implemented a SetEqualColumns toggle. Since profile data is highly structured, an equal distribution I have updated the PR description with screenshots of every table output to demonstrate that the dynamic scaling |
4fa2ff2 to
c217bd5
Compare
evankanderson
left a comment
There was a problem hiding this comment.
I'm liking the reduced dependencies for go-pretty over charmbracelet; a few comments and styling questions, but I think this is getting close.
| // TODO: add automerge common cells (name/entity) | ||
| []string{"Entity", "Rule Name", "Status", "Details"}). | ||
| SetAutoMerge(true). | ||
| SetEqualColumns(true) |
There was a problem hiding this comment.
"Status" is usually short, and "Details" is often long on failure, so you may want to adjust those.
| failureStatus = "failure" | ||
| errorStatus = "error" | ||
| skippedStatus = "skipped" | ||
| pendingStatus = "pending" |
There was a problem hiding this comment.
it is unused so i removed (re-added it)
| AddRowWithColor(row ...layouts.ColoredColumn) | ||
| // Render outputs the table to stdout (TODO: make output configurable) | ||
| Render() | ||
| // SeparateRows ensures each row is clearly separated (probably because it is multi-line) |
There was a problem hiding this comment.
I think a comment for this method makes sense.
There was a problem hiding this comment.
fixed the todo, will re-add 2nd comment
| type Table interface { | ||
| AddRow(row ...string) | ||
| AddRowWithColor(row ...layouts.ColoredColumn) | ||
| // Render outputs the table to stdout (TODO: make output configurable) |
There was a problem hiding this comment.
Oooh! Now I see what's going on with the other PR -- it looks like table rendering doesn't use cmd.Out, huh?
How easy would that be to fix?
7bf6775 to
3c87969
Compare
Signed-off-by: DharunMR <maddharun56@gmail.com>
Signed-off-by: DharunMR <maddharun56@gmail.com>
Signed-off-by: DharunMR <maddharun56@gmail.com>
Signed-off-by: DharunMR <maddharun56@gmail.com>
3c87969 to
518aa5f
Compare
evankanderson
left a comment
There was a problem hiding this comment.
This looks close enough that I'd like to merge it, despite a few cleanup items that you could open another PR for if you want.
|
|
||
| renderRuleEvaluationStatusTable(resp.Data, historyTable, emoji) | ||
| historyTable.Render() | ||
| fmt.Println("") |
There was a problem hiding this comment.
You want to update this output line, too.
There was a problem hiding this comment.
Sry, I dont get what to update?
There was a problem hiding this comment.
The fmt.Println("") is going to write to os.Stdout; you probably want to change this to:
| fmt.Println("") | |
| w.Write("\n") |
There was a problem hiding this comment.
(But this can happen in your other testing PR)
| // Ordering is fixed for evaluation history | ||
| // log and the next page points to older | ||
| // records. | ||
| msg := fmt.Sprintf("Older records: %s", |
|
|
||
| func marshalStructOrEmpty(v *structpb.Struct) string { | ||
| if v == nil { | ||
| if len(v.AsMap()) == 0 { |
There was a problem hiding this comment.
We should do the AsMap conversion once (or check len(v.GetFields()) here to avoid any conversion the first time).
| func (l *lipGlossTable) AddRow(row ...string) { | ||
| l.table.Row(row...) | ||
| l.rows++ | ||
| func (l *goPrettyTable) SetAutoMerge(merge bool) Table { |
There was a problem hiding this comment.
This should probably be "g" for the object; I'm surprised none of the linters complained.
| if l.numCols > 0 { | ||
| // If we have a deficit or surplus due to integer rounding, | ||
| // adjust the last column to snap to the edge. | ||
| if assignedWidths[l.numCols-1]+diff > 0 { |
There was a problem hiding this comment.
This should probably be 5 to line up with "share", right?
There was a problem hiding this comment.
yes wraping words too short will be hard to read, i changed it
|
|
||
| l.t.SetColumnConfigs(configs) | ||
|
|
||
| l.t.SetAllowedRowLength(w) |
There was a problem hiding this comment.
This seems to be deprecated in favor of:
| l.t.SetAllowedRowLength(w) | |
| l.t.Style.Size.WidthMax = w |
There was a problem hiding this comment.
you are absolutely right
Yes i'll open a seperate pr for cleanup tonight |
|
The test failure appears to be legitimate, and does not appear in |
Signed-off-by: DharunMR <maddharun56@gmail.com>
|
@evankanderson i've also made changes as recent suggestion
I have made changes, except this |
|
|
||
| renderRuleEvaluationStatusTable(resp.Data, historyTable, emoji) | ||
| historyTable.Render() | ||
| fmt.Println("") |
There was a problem hiding this comment.
The fmt.Println("") is going to write to os.Stdout; you probably want to change this to:
| fmt.Println("") | |
| w.Write("\n") |
|
|
||
| renderRuleEvaluationStatusTable(resp.Data, historyTable, emoji) | ||
| historyTable.Render() | ||
| fmt.Println("") |
There was a problem hiding this comment.
(But this can happen in your other testing PR)

Summary
This PR overhauls the internal CLI table engine to provide a more professional and readable user interface across all Minder commands. By leveraging go-pretty/v6 more effectively, the CLI now supports visual grouping of data in terminal.
Key Improvements
After Changes