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

example(table): fixed text that was too long to be displayed in the animation #484

Merged
merged 2 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions _examples/table/boxed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ func main() {
// Data can also be generated and inserted later.
pterm.DefaultTable.WithHasHeader().WithBoxed().WithData(pterm.TableData{
{"Firstname", "Lastname", "Email", "Note"},
{"Paul", "Dean", "nisi.dictum.augue@velitAliquam.co.uk", ""},
{"Callie", "Mckay", "egestas.nunc.sed@est.com", "这是一个测试, haha!"},
{"Libby", "Camacho", "aliquet.lobortis@semper.com", "just a test, hey!"},
{"Paul", "Dean", "augue@velitAliquam.co.uk", ""},
{"Callie", "Mckay", "nunc.sed@est.com", "这是一个测试, haha!"},
{"Libby", "Camacho", "lobortis@semper.com", "just a test, hey!"},
{"张", "小宝", "zhang@example.com", ""},
}).Render()
}
13 changes: 7 additions & 6 deletions _examples/table/demo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ func main() {
// Data can also be generated and inserted later.
pterm.DefaultTable.WithHasHeader().WithData(pterm.TableData{
{"Firstname", "Lastname", "Email", "Note"},
{"Paul", "Dean", "nisi.dictum.augue@velitAliquam.co.uk", ""},
{"Callie", "Mckay", "egestas.nunc.sed@est.com", "这是一个测试, haha!"},
{"Libby", "Camacho", "aliquet.lobortis@semper.com", "just a test, hey!"},
{"Paul", "Dean", "augue@velitAliquam.co.uk", ""},
{"Callie", "Mckay", "nunc.sed@est.com", "这是一个测试, haha!"},
{"Libby", "Camacho", "lobortis@semper.com", "just a test, hey!"},
{"张", "小宝", "zhang@example.com", ""},
}).Render()

pterm.Println() // Blank line

// Create a table with multiple lines in a row.
pterm.DefaultTable.WithHasHeader().WithData(pterm.TableData{
{"Firstname", "Lastname", "Email"},
{"Paul\n\nNewline", "Dean", "nisi.dictum.augue@velitAliquam.co.uk"},
{"Callie", "Mckay", "egestas.nunc.sed@est.com\nNewline"},
{"Libby", "Camacho", "aliquet.lobortis@semper.com"},
{"Paul\n\nNewline", "Dean", "augue@velitAliquam.co.uk"},
{"Callie", "Mckay", "nunc.sed@est.com\nNewline"},
{"Libby", "Camacho", "lobortis@semper.com"},
{"张", "小宝", "zhang@example.com"},
}).Render()
}
6 changes: 3 additions & 3 deletions _examples/table/multiple-lines/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ func main() {
// Create a table with multiple lines in a row and set a row separator.
pterm.DefaultTable.WithHasHeader().WithRowSeparator("-").WithHeaderRowSeparator("-").WithData(pterm.TableData{
{"Firstname", "Lastname", "Email"},
{"Paul\n\nNewline", "Dean", "nisi.dictum.augue@velitAliquam.co.uk"},
{"Callie", "Mckay", "egestas.nunc.sed@est.com\nNewline"},
{"Libby", "Camacho", "aliquet.lobortis@semper.com"},
{"Paul\n\nNewline", "Dean", "augue@velitAliquam.co.uk"},
{"Callie", "Mckay", "nunc.sed@est.com\nNewline"},
{"Libby", "Camacho", "lobortis@semper.com"},
{"张", "小宝", "zhang@example.com"},
}).Render()
}
7 changes: 4 additions & 3 deletions _examples/table/right-alignment/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ func main() {
// Data can also be generated and inserted later.
pterm.DefaultTable.WithHasHeader().WithRightAlignment().WithData(pterm.TableData{
{"Firstname", "Lastname", "Email", "Note"},
{"Paul", "Dean", "nisi.dictum.augue@velitAliquam.co.uk", ""},
{"Callie", "Mckay", "egestas.nunc.sed@est.com", "这是一个测试, haha!"},
{"Libby", "Camacho", "aliquet.lobortis@semper.com", "just a test, hey!"},
{"Paul", "Dean", "augue@velitAliquam.co.uk", ""},
{"Callie", "Mckay", "nunc.sed@est.com", "这是一个测试, haha!"},
{"Libby", "Camacho", "lobortis@semper.com", "just a test, hey!"},
{"张", "小宝", "zhang@example.com", ""},
}).Render()
}