mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
cmd/geth: remove tablewriter dependency and implement manual output formatting
This commit is contained in:
parent
e0d81d1e99
commit
2ab5b9c110
5 changed files with 31 additions and 15 deletions
BIN
bin/golangci-lint
Executable file
BIN
bin/golangci-lint
Executable file
Binary file not shown.
|
|
@ -760,10 +760,16 @@ func showMetaData(ctx *cli.Context) error {
|
|||
data = append(data, []string{"headHeader.Root", fmt.Sprintf("%v", h.Root)})
|
||||
data = append(data, []string{"headHeader.Number", fmt.Sprintf("%d (%#x)", h.Number, h.Number)})
|
||||
}
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
table.SetHeader([]string{"Field", "Value"})
|
||||
table.AppendBulk(data)
|
||||
table.Render()
|
||||
table.SetHeader([]string{"Key", "Value"})
|
||||
|
||||
for key, value := range stats {
|
||||
table.Append([]string{key, fmt.Sprintf("%v", value)})
|
||||
}
|
||||
|
||||
fmt.Println("Key\tValue")
|
||||
for key, value := range stats {
|
||||
fmt.Printf("%s\t%v\n", key, value)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,3 +206,11 @@ func (t *Table) printRow(row []string, widths []int) {
|
|||
}
|
||||
fmt.Fprintln(t.out)
|
||||
}
|
||||
package rawdb
|
||||
|
||||
import "io"
|
||||
|
||||
// TinyGo doesn't support table formatting; use minimal placeholder.
|
||||
type Table struct{}
|
||||
|
||||
func NewTableWriter(w io.Writer) *Table { return &Table{} }
|
||||
|
|
|
|||
|
|
@ -19,15 +19,13 @@
|
|||
|
||||
package rawdb
|
||||
|
||||
import (
|
||||
"io"
|
||||
import "io"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
)
|
||||
|
||||
// Re-export the real tablewriter types and functions
|
||||
type Table = tablewriter.Table
|
||||
|
||||
func newTableWriter(w io.Writer) *Table {
|
||||
return tablewriter.NewWriter(w)
|
||||
// Table is a placeholder struct for manual table rendering.
|
||||
type Table struct {
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
func NewTableWriter(w io.Writer) *Table {
|
||||
return &Table{w: w}
|
||||
}
|
||||
|
|
|
|||
4
e --short HEAD
Normal file
4
e --short HEAD
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
docs/fix-broken-links[m
|
||||
docs/fix-readme-typo[m
|
||||
* [32mevent/simplify-conditional[m
|
||||
master[m
|
||||
Loading…
Reference in a new issue