Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table: auto-merge issue with bottom cell separator #215

Closed
jedib0t opened this issue Jul 15, 2022 · 3 comments · Fixed by #216
Closed

table: auto-merge issue with bottom cell separator #215

jedib0t opened this issue Jul 15, 2022 · 3 comments · Fixed by #216
Assignees
Labels
bug Something isn't working

Comments

@jedib0t
Copy link
Owner

jedib0t commented Jul 15, 2022

That did it, thank you very much!

Unrelated but looks like the last horizontal line that has auto merge has a single vertical bar tick at the end. In the output below you can see it after cf01 on the last line. Let me know if you want a separate issue logged.

╭────────────┬───────────────────┬───────────────┬────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ID         │ NAME              │ TYPE          │ ATTRIBUTES │ CONFIGURATION                                                                                                          │
├────────────┼───────────────────┼───────────────┼────────────┼──────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ DtMM5CCOZ  │ macCheck          │ MAC           │ pc1        │ MAC Address      │ 4b3...ae2, 5bc...f57, 626...d05 9cb...c09, e04..                                                    │
│            │                   │               │            │                  │ .d75, e0d...296 e58......                                                                           │
├────────────┼───────────────────┼───────────────┼────────────┼──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ NA8HvBC3Z- │ mfaCheck          │ MFA           │ wiggle     │ Timeout          │ never                                                                                               │
│            │                   │               │            ├──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│            │                   │               │            │ Prompt On Wake   │ false                                                                                               │
│            │                   │               │            ├──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│            │                   │               │            │ Prompt On Unlock │ true                                                                                                │
├────────────┼───────────────────┼───────────────┼────────────┼──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ RwaMDCB3K- │ osCheck           │ OS            │ pc1        │ Windows          │ >=10.0.18364 <=10.1.0                                                                               │
├────────────┼───────────────────┼───────────────┼────────────┼──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ e6YMDCC3K- │ processCheckMulti │ PROCESS_MULTI │ <none>     │ Semantic         │ AllOf                                                                                               │
│            │                   │               │            ├──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│            │                   │               │            │ Path             │ C:\process2.exe                                                                                     │
│            │                   │               │            ├──────────────────┼──────────────────────────────────────────────────┬──────────────────────────────────────────────────┤
│            │                   │               │            │                  │ Hashes                                           │ 59e6...3f16                                      │
│            │                   │               │            ├──────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────┤
│            │                   │               │            │                  │ Signers                                          │ f56d...187a                                      │
├────────────┼───────────────────┼───────────────┼────────────┼──────────────────┼──────────────────────────────────────────────────┴──────────────────────────────────────────────────┤
│ enMM5BB3K- │ domainCheck       │ DOMAIN        │ pc1        │ Windows Domain   │ mycompany.com, workgroup                                                                            │
├────────────┼───────────────────┼───────────────┼────────────┼──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ qNNM5CBOZ- │ processCheck      │ PROCESS       │ pc1        │ Path             │ C:\Program Files\Sublime Text 3\sublime_text.exe                                                    │
│            │                   │               │            ├──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│            │                   │               │            │ Hash             │ 59e6...3f16                                                                                         │
│            │                   │               │            ├──────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│            │                   │               │            │ Signer           │ 834f...cf01                                                                                         │
╰────────────┴───────────────────┴───────────────┴────────────┴──────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────╯

Originally posted by @andrewpmartinez in #207 (comment)

@jedib0t
Copy link
Owner Author

jedib0t commented Jul 15, 2022

@andrewpmartinez - fixed this issue and cut a new tag for you: https://github.com/jedib0t/go-pretty/releases/tag/v6.3.5

Can you please try it and lemme know if that fixed it for you?

@jedib0t
Copy link
Owner Author

jedib0t commented Jul 15, 2022

Also, you can use nested tables for the Configuration column -- tables within tables -- instead of using auto-merge to achieve a table like the above. Lemme know if you have any questions.

Sample:

package main

import (
	"fmt"

	"github.com/jedib0t/go-pretty/v6/table"
	"github.com/jedib0t/go-pretty/v6/text"
)

func main() {
	generateInnerTable := func() table.Writer {
		tw := table.NewWriter()
		tw.SetStyle(table.StyleRounded)
		tw.Style().Options.DrawBorder = false
		tw.SetColumnConfigs([]table.ColumnConfig{
			{Number: 1, WidthMin: 16, WidthMax: 16},
			{Number: 2, WidthMax: 32, WidthMaxEnforcer: text.WrapSoft},
		})
		return tw
	}

	twConfigurationMAC := generateInnerTable()
	twConfigurationMAC.AppendRow(table.Row{"MAC Address", "4b3...ae2, 5bc...f57, 626...d05 9cb...c09, e04...d75, e0d...296 e58......"})

	twConfigurationMFA := generateInnerTable()
	twConfigurationMFA.AppendRow(table.Row{"Timeout", "never"})
	twConfigurationMFA.AppendRow(table.Row{"Prompt on Wake", "false"})
	twConfigurationMFA.AppendRow(table.Row{"Prompt on Unlock", "true"})

	twConfigurationCheckMulti := generateInnerTable()
	twConfigurationCheckMulti.AppendRow(table.Row{"Semantic", "AllOf"})
	twConfigurationCheckMulti.AppendRow(table.Row{"Path", "C:\\process2.exe"})
	twConfigurationCheckMulti.AppendRow(table.Row{"Hashes", "59e6...3f16"})
	twConfigurationCheckMulti.AppendRow(table.Row{"Signers", "f56d...187a"})

	tw := table.NewWriter()
	tw.AppendHeader(table.Row{"ID", "Name", "Type", "Attributes", "Configuration"})
	tw.AppendRow(table.Row{"DtMM5CCOZ", "macCheck", "MAC", "pc1", twConfigurationMAC.Render()})
	tw.AppendRow(table.Row{"NA8HvBC3Z-", "mfaCheck", "MFA", "wiggle", twConfigurationMFA.Render()})
	tw.AppendRow(table.Row{"e6YMDCC3K-", "processCheckMulti", "PROCESS_MULTI", "<none>", twConfigurationCheckMulti.Render()})
	tw.SetStyle(table.StyleRounded)
	tw.Style().Options.SeparateRows = true

	fmt.Println(tw.Render())
}

Output:

╭────────────┬───────────────────┬───────────────┬────────────┬───────────────────────────────────────────────────────╮
│ ID         │ NAME              │ TYPE          │ ATTRIBUTES │ CONFIGURATION                                         │
├────────────┼───────────────────┼───────────────┼────────────┼───────────────────────────────────────────────────────┤
│ DtMM5CCOZ  │ macCheck          │ MAC           │ pc1        │  MAC Address      │ 4b3...ae2, 5bc...f57, 626...d05   │
│            │                   │               │            │                   │ 9cb...c09, e04...d75, e0d...296   │
│            │                   │               │            │                   │ e58......                         │
├────────────┼───────────────────┼───────────────┼────────────┼───────────────────────────────────────────────────────┤
│ NA8HvBC3Z- │ mfaCheck          │ MFA           │ wiggle     │  Timeout          │ never                             │
│            │                   │               │            │  Prompt on Wake   │ false                             │
│            │                   │               │            │  Prompt on Unlock │ true                              │
├────────────┼───────────────────┼───────────────┼────────────┼───────────────────────────────────────────────────────┤
│ e6YMDCC3K- │ processCheckMulti │ PROCESS_MULTI │ <none>     │  Semantic         │ AllOf                             │
│            │                   │               │            │  Path             │ C:\process2.exe                   │
│            │                   │               │            │  Hashes           │ 59e6...3f16                       │
│            │                   │               │            │  Signers          │ f56d...187a                       │
╰────────────┴───────────────────┴───────────────┴────────────┴───────────────────────────────────────────────────────╯

@andrewpmartinez
Copy link

It does, thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants