
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
github.com/lensesio/tableprinter
tableprinter is an intelligent value-to-table formatter and writer. It uses a customized version of olekukonko/tablewriter to render a result table.
It checks every in data and transforms those data(structure values, slices, maps, single lists that may contain different type of values such as go standard values like int
, string
even a value that implements the fmt.Stringer
interface) to a table formatted text and outputs it to an io.Writer
. Like encoding/json#Encode
but for tables.
The only requirement is the Go Programming Language, at least version 1.10.
$ go get -u github.com/lensesio/tableprinter
package main
import (
"os"
"sort"
"github.com/kataras/tablewriter"
"github.com/lensesio/tableprinter"
)
type person struct {
Firstname string `header:"first name"`
Lastname string `header:"last name"`
}
func main() {
printer := tableprinter.New(os.Stdout)
persons := []person{
{"Chris", "Doukas"},
{"Georgios", "Callas"},
{"Ioannis", "Christou"},
{"Nikolaos", "Doukas"},
{"Dimitrios", "Dellis"},
}
sort.Slice(persons, func(i, j int) bool {
return persons[j].Firstname > persons[i].Firstname
})
// Optionally, customize the table, import of the underline 'tablewriter' package is required for that.
printer.BorderTop, printer.BorderBottom, printer.BorderLeft, printer.BorderRight = true, true, true, true
printer.CenterSeparator = "│"
printer.ColumnSeparator = "│"
printer.RowSeparator = "─"
printer.HeaderBgColor = tablewriter.BgBlackColor
printer.HeaderFgColor = tablewriter.FgGreenColor
// Print the slice of structs as table, as shown above.
printer.Print(persons)
}
Current: v0.0.3
Read more about Semantic Versioning 2.0.0
Distributed under Apache Version 2.0, see LICENSE for more information.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.