Skip to content

Commit

Permalink
example(table): fixed text that was too long to be displayed in the a…
Browse files Browse the repository at this point in the history
…nimation (#484)
  • Loading branch information
floaust committed Apr 5, 2023
1 parent 971fa81 commit 4420c38
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
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()
}

0 comments on commit 4420c38

Please sign in to comment.