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,11 +760,17 @@ func showMetaData(ctx *cli.Context) error {
|
||||||
data = append(data, []string{"headHeader.Root", fmt.Sprintf("%v", h.Root)})
|
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)})
|
data = append(data, []string{"headHeader.Number", fmt.Sprintf("%d (%#x)", h.Number, h.Number)})
|
||||||
}
|
}
|
||||||
table := tablewriter.NewWriter(os.Stdout)
|
table.SetHeader([]string{"Key", "Value"})
|
||||||
table.SetHeader([]string{"Field", "Value"})
|
|
||||||
table.AppendBulk(data)
|
for key, value := range stats {
|
||||||
table.Render()
|
table.Append([]string{key, fmt.Sprintf("%v", value)})
|
||||||
return nil
|
}
|
||||||
|
|
||||||
|
fmt.Println("Key\tValue")
|
||||||
|
for key, value := range stats {
|
||||||
|
fmt.Printf("%s\t%v\n", key, value)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func inspectAccount(db *triedb.Database, start uint64, end uint64, address common.Address, raw bool) error {
|
func inspectAccount(db *triedb.Database, start uint64, end uint64, address common.Address, raw bool) error {
|
||||||
|
|
|
||||||
|
|
@ -206,3 +206,11 @@ func (t *Table) printRow(row []string, widths []int) {
|
||||||
}
|
}
|
||||||
fmt.Fprintln(t.out)
|
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
|
package rawdb
|
||||||
|
|
||||||
import (
|
import "io"
|
||||||
"io"
|
|
||||||
|
|
||||||
"github.com/olekukonko/tablewriter"
|
// Table is a placeholder struct for manual table rendering.
|
||||||
)
|
type Table struct {
|
||||||
|
w io.Writer
|
||||||
// Re-export the real tablewriter types and functions
|
}
|
||||||
type Table = tablewriter.Table
|
|
||||||
|
func NewTableWriter(w io.Writer) *Table {
|
||||||
func newTableWriter(w io.Writer) *Table {
|
return &Table{w: w}
|
||||||
return tablewriter.NewWriter(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