-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples(table): added more examples
- Loading branch information
1 parent
1a95c8a
commit c69f5ba
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
|
||
import "github.com/pterm/pterm" | ||
|
||
func main() { | ||
// Create a fork of the default table, fill it with data and print it. | ||
// 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!"}, | ||
}).Render() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
|
||
import "github.com/pterm/pterm" | ||
|
||
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"}, | ||
{"张", "小宝", "zhang@example.com"}, | ||
}).Render() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
|
||
import "github.com/pterm/pterm" | ||
|
||
func main() { | ||
// Create a fork of the default table, fill it with data and print it. | ||
// 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!"}, | ||
}).Render() | ||
} |