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

[bug] A long string causes the table to render extra rows #203

Open
27149chen opened this issue May 25, 2022 · 0 comments
Open

[bug] A long string causes the table to render extra rows #203

27149chen opened this issue May 25, 2022 · 0 comments

Comments

@27149chen
Copy link

27149chen commented May 25, 2022

code:

data := [][]string{
    {"1/1/2014", "Domain name", "2233", "$10.98"},
    {"1/1/2014", "January Hosting", "2233", "$54.95"},
    {"1/4/2014", "February Hosting a very very long message", "2233", "$51.00"},
    {"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
}

table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
table.SetAlignment(tablewriter.ALIGN_LEFT)
table.AppendBulk(data)
table.Render()

result:

DATE DESCRIPTION CV2 AMOUNT
1/1/2014 Domain name 2233 $10.98
1/1/2014 January Hosting 2233 $54.95
1/4/2014 February Hosting a very very 2233 $51.00
long message
1/4/2014 February Extra Bandwidth 2233 $30.00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant