mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 22:34:19 +02:00
Compare commits
8 Commits
fix/api-re
...
feature/en
| Author | SHA1 | Date | |
|---|---|---|---|
| 83307ac677 | |||
| 56e4b34ab9 | |||
| 1f96fb9ab3 | |||
| c554b2a6cb | |||
| 068711589b | |||
| ffe79a2277 | |||
| 56c636fa2a | |||
| b20f3b39a3 |
4
Makefile
4
Makefile
@@ -67,10 +67,10 @@ test: clean buildlocal
|
|||||||
|
|
||||||
testlint: test lint
|
testlint: test lint
|
||||||
|
|
||||||
lint-basic:
|
lint:
|
||||||
golangci-lint run --enable-only errcheck,govet,ineffassign,staticcheck,unused
|
golangci-lint run --enable-only errcheck,govet,ineffassign,staticcheck,unused
|
||||||
|
|
||||||
lint:
|
lint-full:
|
||||||
golangci-lint run --show-stats=false
|
golangci-lint run --show-stats=false
|
||||||
|
|
||||||
testfuzzy: clean
|
testfuzzy: clean
|
||||||
|
|||||||
@@ -538,7 +538,6 @@ index - manage indicies
|
|||||||
close - close an index
|
close - close an index
|
||||||
fields - show info about field capabilities
|
fields - show info about field capabilities
|
||||||
ilm - show ilm status
|
ilm - show ilm status
|
||||||
du - show index disk usage
|
|
||||||
alias - manage index aliases
|
alias - manage index aliases
|
||||||
create - create an index alias
|
create - create an index alias
|
||||||
list - list index aliases
|
list - list index aliases
|
||||||
@@ -556,7 +555,6 @@ node - manage nodes
|
|||||||
list - list nodes
|
list - list nodes
|
||||||
show - show details about a node
|
show - show details about a node
|
||||||
clients - show node http clients
|
clients - show node http clients
|
||||||
usage - show node usage stats
|
|
||||||
role - manage roles
|
role - manage roles
|
||||||
list - list roles
|
list - list roles
|
||||||
show - show details about a role
|
show - show details about a role
|
||||||
|
|||||||
@@ -91,12 +91,6 @@ func ApiRepl(conf *cfg.Config) *cli.Command {
|
|||||||
Aliases: []string{"p"},
|
Aliases: []string{"p"},
|
||||||
Sources: cli.EnvVars("PAGER", "ES_JSON_PAGER"),
|
Sources: cli.EnvVars("PAGER", "ES_JSON_PAGER"),
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
|
||||||
Name: "human-readable-cat",
|
|
||||||
Usage: "enable human readable /_cat output",
|
|
||||||
Destination: &conf.HumanCat,
|
|
||||||
Aliases: []string{"H"},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||||
|
|||||||
22
cmd/index.go
22
cmd/index.go
@@ -41,7 +41,6 @@ func Index(conf *cfg.Config) *cli.Command {
|
|||||||
IndexClose(conf),
|
IndexClose(conf),
|
||||||
IndexFields(conf),
|
IndexFields(conf),
|
||||||
IndexIlm(conf),
|
IndexIlm(conf),
|
||||||
IndexDu(conf),
|
|
||||||
|
|
||||||
// sub commands
|
// sub commands
|
||||||
IndexAlias(conf),
|
IndexAlias(conf),
|
||||||
@@ -278,24 +277,3 @@ func IndexIlm(conf *cfg.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IndexDu(conf *cfg.Config) *cli.Command {
|
|
||||||
return &cli.Command{
|
|
||||||
Name: "du",
|
|
||||||
Usage: "show index disk usage",
|
|
||||||
UsageText: "index du <index>",
|
|
||||||
|
|
||||||
ShellComplete: func(ctx context.Context, cmd *cli.Command) {
|
|
||||||
complete(conf, cmd, Cindex)
|
|
||||||
},
|
|
||||||
|
|
||||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
||||||
index := cmd.Args().Get(0)
|
|
||||||
if index == "" {
|
|
||||||
return errors.New("no index specified")
|
|
||||||
}
|
|
||||||
|
|
||||||
return es.IndexDiskusage(conf, index)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
17
cmd/node.go
17
cmd/node.go
@@ -36,7 +36,6 @@ func Node(conf *cfg.Config) *cli.Command {
|
|||||||
NodeList(conf),
|
NodeList(conf),
|
||||||
NodeShow(conf),
|
NodeShow(conf),
|
||||||
NodeClients(conf),
|
NodeClients(conf),
|
||||||
NodeUsage(conf),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,19 +103,3 @@ func NodeClients(conf *cfg.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NodeUsage(conf *cfg.Config) *cli.Command {
|
|
||||||
return &cli.Command{
|
|
||||||
Name: "usage",
|
|
||||||
Usage: "show node usage stats",
|
|
||||||
UsageText: "usage [options] [<node>]",
|
|
||||||
|
|
||||||
ShellComplete: func(ctx context.Context, cmd *cli.Command) {
|
|
||||||
complete(conf, cmd, Cnode)
|
|
||||||
},
|
|
||||||
|
|
||||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
||||||
return es.NodeUsage(conf, cmd.Args().Get(0))
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -101,8 +101,7 @@ type Config struct {
|
|||||||
MaxDocs, MaxShardSize, MaxShardDocs int // roll over
|
MaxDocs, MaxShardSize, MaxShardDocs int // roll over
|
||||||
DryRun bool // rollover: -n
|
DryRun bool // rollover: -n
|
||||||
|
|
||||||
Tag string // api ls: -t
|
Tag string // api ls: -t
|
||||||
HumanCat bool // api repl: -H
|
|
||||||
|
|
||||||
Ilm Ilm // ilm create
|
Ilm Ilm // ilm create
|
||||||
|
|
||||||
|
|||||||
@@ -45,25 +45,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
intro = `# Input format: verb path [data]"
|
intro = `Input format: verb path [data]"
|
||||||
#
|
|
||||||
# Example:
|
Example:
|
||||||
#
|
|
||||||
# post /yourindex/_ccr/pause_follow
|
post /yourindex/_ccr/pause_follow
|
||||||
# put /yourindex/_settings {"number_of_replicas": 1}
|
put /yourindex/_settings {"number_of_replicas": 1}
|
||||||
#
|
|
||||||
# You can also put multiline JSON after the path like:
|
You can also put multiline JSON after the path like:
|
||||||
#
|
|
||||||
# put /yourindex/_settings
|
put /yourindex/_settings
|
||||||
# {
|
{
|
||||||
# "number_of_replicas": 1
|
"number_of_replicas": 1
|
||||||
# }
|
}
|
||||||
#
|
|
||||||
# If you do NOT supply a JSON in the first line, you need to hit ENTER
|
If you do NOT supply a JSON in the first line, you need to hit ENTER
|
||||||
# twice to complete.
|
twice to complete.`
|
||||||
#
|
|
||||||
# Supply the flag --human-readable-cat, -H to view /_cat API calls in
|
|
||||||
# human readable form.`
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// holds an API operation via go-openapi/spec
|
// holds an API operation via go-openapi/spec
|
||||||
@@ -146,11 +143,7 @@ func ApiRepl(conf *cfg.Config) error {
|
|||||||
fmt.Printf("failed to call API: %s\n", esErrorString(err))
|
fmt.Printf("failed to call API: %s\n", esErrorString(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if conf.HumanCat && strings.HasPrefix(parts[1], "/_cat") {
|
pageJsonOutput(conf, raw)
|
||||||
fmt.Println(string(raw))
|
|
||||||
} else {
|
|
||||||
pageJsonOutput(conf, raw)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:nilerr
|
//nolint:nilerr
|
||||||
@@ -223,10 +216,8 @@ func CallAPI(conf *cfg.Config, verb, path, data string) ([]byte, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !conf.HumanCat || (conf.HumanCat && !strings.HasPrefix(path, "/_cat")) {
|
req.Header.Add("Content-Type", "application/json")
|
||||||
req.Header.Add("Content-Type", "application/json")
|
req.Header.Add("Accept", "application/json")
|
||||||
req.Header.Add("Accept", "application/json")
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure we have got all we need
|
// make sure we have got all we need
|
||||||
if err := conf.DefaultCluster.CheckAuth(); err != nil {
|
if err := conf.DefaultCluster.CheckAuth(); err != nil {
|
||||||
@@ -280,8 +271,7 @@ func prettyfiJson(conf *cfg.Config, raw []byte) (string, error) {
|
|||||||
|
|
||||||
err := json.Indent(&pretty, raw, "", "\t")
|
err := json.Indent(&pretty, raw, "", "\t")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//nolint:nilerr
|
return "", fmt.Errorf("json parse error: %w", err)
|
||||||
return string(raw), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pretty.String(), nil
|
return pretty.String(), nil
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ package es
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -30,7 +28,6 @@ import (
|
|||||||
|
|
||||||
"codeberg.org/scip/esctl/pkg/cfg"
|
"codeberg.org/scip/esctl/pkg/cfg"
|
||||||
"codeberg.org/scip/esctl/pkg/printer"
|
"codeberg.org/scip/esctl/pkg/printer"
|
||||||
"github.com/charmbracelet/lipgloss"
|
|
||||||
"github.com/elastic/go-elasticsearch/v9/typedapi/cat/indices"
|
"github.com/elastic/go-elasticsearch/v9/typedapi/cat/indices"
|
||||||
"github.com/elastic/go-elasticsearch/v9/typedapi/esdsl"
|
"github.com/elastic/go-elasticsearch/v9/typedapi/esdsl"
|
||||||
"github.com/elastic/go-elasticsearch/v9/typedapi/types/enums/healthstatus"
|
"github.com/elastic/go-elasticsearch/v9/typedapi/types/enums/healthstatus"
|
||||||
@@ -309,79 +306,3 @@ func IndexFields(conf *cfg.Config, index string) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type Diskusage struct {
|
|
||||||
Total int64 `json:"total_in_bytes"`
|
|
||||||
Points int64 `json:"points_in_bytes"`
|
|
||||||
Norms int64 `json:"norms_in_bytes"`
|
|
||||||
TermVectors int64 `json:"term_vectors_in_bytes"`
|
|
||||||
KnnVectors int64 `json:"knn_vectors_in_bytes"`
|
|
||||||
BloomFilter int64 `json:"bloom_filter_in_bytes"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type IndexDiskUsage struct {
|
|
||||||
AllFields Diskusage `json:"all_fields"`
|
|
||||||
Fields map[string]Diskusage `json:"fields"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResIndexDiskUsage map[string]IndexDiskUsage
|
|
||||||
|
|
||||||
func IndexDiskusage(conf *cfg.Config, index string) error {
|
|
||||||
var bold = lipgloss.NewStyle().Bold(true)
|
|
||||||
|
|
||||||
res, err := conf.DefaultCluster.ES().Indices.DiskUsage(index).
|
|
||||||
RunExpensiveTasks(true).
|
|
||||||
Do(context.Background())
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to retrieve index disk usage: %w", esErrorString(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
duRes := ResIndexDiskUsage{}
|
|
||||||
if err := json.Unmarshal(res, &duRes); err != nil {
|
|
||||||
return fmt.Errorf("failed to unmarshal disk usage response: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
diskusage, exists := duRes[index]
|
|
||||||
if !exists {
|
|
||||||
return errors.New("no disk usage reported for index")
|
|
||||||
}
|
|
||||||
|
|
||||||
table := printer.NewTableEmpty(conf).
|
|
||||||
WithHeaders("field", "bloom filter", "norms", "points", "term vectors", "knn vectors", "total")
|
|
||||||
|
|
||||||
for name, field := range diskusage.Fields {
|
|
||||||
if strings.HasPrefix(name, "_") || strings.HasSuffix(name, ".keyword") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
table.AddRow(
|
|
||||||
name,
|
|
||||||
printer.Bytes(field.BloomFilter),
|
|
||||||
printer.Bytes(field.Norms),
|
|
||||||
printer.Bytes(field.Points),
|
|
||||||
printer.Bytes(field.TermVectors),
|
|
||||||
printer.Bytes(field.KnnVectors),
|
|
||||||
printer.Bytes(field.Total),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
all := diskusage.AllFields
|
|
||||||
|
|
||||||
table.Sort()
|
|
||||||
|
|
||||||
table.AddRowLate(
|
|
||||||
bold.Render("Summary"),
|
|
||||||
printer.Bytes(all.BloomFilter),
|
|
||||||
printer.Bytes(all.Norms),
|
|
||||||
printer.Bytes(all.Points),
|
|
||||||
printer.Bytes(all.TermVectors),
|
|
||||||
printer.Bytes(all.KnnVectors),
|
|
||||||
printer.Bytes(all.Total),
|
|
||||||
)
|
|
||||||
|
|
||||||
if err := table.Print(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ func NodeList(conf *cfg.Config) error {
|
|||||||
|
|
||||||
slog.Debug("ES result", "nodes", nodes)
|
slog.Debug("ES result", "nodes", nodes)
|
||||||
|
|
||||||
table := printer.NewTableEmpty(conf).WithHeaders(
|
table := printer.NewTable(conf, 7, len(nodes))
|
||||||
"name", "ip", "load1m", "load5m", "load15m", "ram %", "heap %")
|
table.Addheaders("name", "ip", "load1m", "load5m", "load15m", "ram %", "heap %")
|
||||||
|
|
||||||
for _, node := range nodes {
|
for idx, node := range nodes {
|
||||||
table.AddRow(
|
table.Entries[idx] = []any{
|
||||||
*node.Name,
|
*node.Name,
|
||||||
*node.Ip,
|
*node.Ip,
|
||||||
*node.Load1M,
|
*node.Load1M,
|
||||||
@@ -49,7 +49,7 @@ func NodeList(conf *cfg.Config) error {
|
|||||||
*node.Load15M,
|
*node.Load15M,
|
||||||
node.RamPercent,
|
node.RamPercent,
|
||||||
node.HeapPercent,
|
node.HeapPercent,
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table.Sort()
|
table.Sort()
|
||||||
@@ -113,19 +113,13 @@ func NodeShow(conf *cfg.Config, nodename string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
k8snode := info.Attributes["k8s_node_name"]
|
k8snode := info.Attributes["k8s_node_name"]
|
||||||
rank := "none"
|
|
||||||
|
|
||||||
adsel, exists := stat.AdaptiveSelection[id]
|
|
||||||
if exists {
|
|
||||||
rank = *adsel.Rank
|
|
||||||
}
|
|
||||||
|
|
||||||
table.Entries = [][]any{
|
table.Entries = [][]any{
|
||||||
{"Id", id},
|
{"Id", id},
|
||||||
{"Name", nodename},
|
{"Name", nodename},
|
||||||
{"Kubernetes node", k8snode},
|
{"Kubernetes node", k8snode},
|
||||||
{"Ip address", info.Ip},
|
{"Ip address", info.Ip},
|
||||||
{"Node rank", rank},
|
{"Node rank", *stat.AdaptiveSelection[id].Rank},
|
||||||
{"JVM", info.Jvm.VmName + " " + info.Jvm.Version},
|
{"JVM", info.Jvm.VmName + " " + info.Jvm.Version},
|
||||||
{"JVM Started", time.UnixMilli(info.Jvm.StartTimeInMillis)},
|
{"JVM Started", time.UnixMilli(info.Jvm.StartTimeInMillis)},
|
||||||
{"OS", info.Os.PrettyName + " " + info.Os.Version},
|
{"OS", info.Os.PrettyName + " " + info.Os.Version},
|
||||||
@@ -235,72 +229,3 @@ func NodeClients(conf *cfg.Config, nodename string) error {
|
|||||||
|
|
||||||
return table.Print()
|
return table.Print()
|
||||||
}
|
}
|
||||||
|
|
||||||
func NodeUsage(conf *cfg.Config, nodeid string) error {
|
|
||||||
usage := conf.DefaultCluster.ES().Nodes.Usage()
|
|
||||||
|
|
||||||
if nodeid != "" {
|
|
||||||
usage.NodeId(nodeid)
|
|
||||||
}
|
|
||||||
|
|
||||||
stats, err := usage.Do(context.Background())
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to get node usage: %w", esErrorString(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
slog.Debug("ES result", "usage", stats)
|
|
||||||
|
|
||||||
table := printer.NewTableEmpty(conf).WithHeaders(
|
|
||||||
"node",
|
|
||||||
"bulk",
|
|
||||||
"doc get",
|
|
||||||
"doc mget",
|
|
||||||
"doc update",
|
|
||||||
"index doc",
|
|
||||||
"index stats",
|
|
||||||
"search",
|
|
||||||
"msearch",
|
|
||||||
"open pit",
|
|
||||||
)
|
|
||||||
|
|
||||||
for id, actions := range stats.Nodes {
|
|
||||||
node, err := getNodeName(conf, id)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
stat := actions.RestActions
|
|
||||||
|
|
||||||
table.AddRow(
|
|
||||||
node,
|
|
||||||
stat["bulk_action"],
|
|
||||||
stat["document_get_action"],
|
|
||||||
stat["document_mget_action"],
|
|
||||||
stat["document_update_action"],
|
|
||||||
stat["document_index_action"],
|
|
||||||
stat["indices_stats_action"],
|
|
||||||
stat["search_action"],
|
|
||||||
stat["msearch_action"],
|
|
||||||
stat["open_point_in_time"],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return table.Print()
|
|
||||||
}
|
|
||||||
|
|
||||||
func getNodeName(conf *cfg.Config, id string) (string, error) {
|
|
||||||
res, err := conf.DefaultCluster.ES().Nodes.Info().
|
|
||||||
Metric("os").
|
|
||||||
Do(context.Background())
|
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("failed to get node info: %w", esErrorString(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
for nodeid, node := range res.Nodes {
|
|
||||||
if id == nodeid {
|
|
||||||
return node.Name, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -163,37 +163,30 @@ func ShardAllocation(conf *cfg.Config, index string) error {
|
|||||||
|
|
||||||
slog.Debug("ES result", "explain", res)
|
slog.Debug("ES result", "explain", res)
|
||||||
|
|
||||||
|
currentNode := res.CurrentNode
|
||||||
|
|
||||||
table := printer.NewTable(conf, 2, 10)
|
table := printer.NewTable(conf, 2, 10)
|
||||||
table.Addheaders("shard allocation setting", "value")
|
table.Addheaders("shard allocation setting", "value")
|
||||||
|
|
||||||
|
roles := make([]string, len(currentNode.Roles))
|
||||||
|
for idx, role := range currentNode.Roles {
|
||||||
|
roles[idx] = role.Name
|
||||||
|
}
|
||||||
|
|
||||||
table.Entries = [][]any{
|
table.Entries = [][]any{
|
||||||
{"Index", index},
|
{"Index", index},
|
||||||
{"Current state", res.CurrentState},
|
{"Current state", res.CurrentState},
|
||||||
|
{"Current node", currentNode.Name},
|
||||||
|
{"Current k8s node", currentNode.Attributes["k8s_node_name"]},
|
||||||
|
{"Current node address", currentNode.TransportAddress},
|
||||||
|
{"Current node id", currentNode.Id},
|
||||||
|
{"Current node weight", currentNode.WeightRanking},
|
||||||
|
{"Current node roles", roles},
|
||||||
{"Can rebalance cluster", res.CanRebalanceCluster.Name},
|
{"Can rebalance cluster", res.CanRebalanceCluster.Name},
|
||||||
{"Can rebalance to another node", res.CanRebalanceToOtherNode.Name},
|
{"Can rebalance to another node", res.CanRebalanceToOtherNode.Name},
|
||||||
{"Can remain on current node", res.CanRemainOnCurrentNode.Name},
|
{"Can remain on current node", res.CanRemainOnCurrentNode.Name},
|
||||||
}
|
}
|
||||||
|
|
||||||
if res.CurrentNode != nil {
|
|
||||||
currentNode := res.CurrentNode
|
|
||||||
roles := make([]string, len(currentNode.Roles))
|
|
||||||
|
|
||||||
for idx, role := range currentNode.Roles {
|
|
||||||
roles[idx] = role.Name
|
|
||||||
}
|
|
||||||
|
|
||||||
table.Entries = append(table.Entries, [][]any{
|
|
||||||
{"Current node", currentNode.Name},
|
|
||||||
{"Current k8s node", currentNode.Attributes["k8s_node_name"]},
|
|
||||||
{"Current node address", currentNode.TransportAddress},
|
|
||||||
{"Current node id", currentNode.Id},
|
|
||||||
{"Current node weight", currentNode.WeightRanking},
|
|
||||||
{"Current node roles", roles},
|
|
||||||
}...)
|
|
||||||
} else {
|
|
||||||
table.AddRow("Current node", "not currently assigned to any node")
|
|
||||||
}
|
|
||||||
|
|
||||||
if res.CurrentState == "unassigned" {
|
if res.CurrentState == "unassigned" {
|
||||||
table.AddRow("Unassignment reason", res.UnassignedInfo.Reason.String()+" at "+res.UnassignedInfo.At.(string))
|
table.AddRow("Unassignment reason", res.UnassignedInfo.Reason.String()+" at "+res.UnassignedInfo.At.(string))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ func any2string(in any) string {
|
|||||||
return strings.Join(val, ",")
|
return strings.Join(val, ",")
|
||||||
case ByteSize:
|
case ByteSize:
|
||||||
return val.String()
|
return val.String()
|
||||||
case *ByteSize:
|
|
||||||
return val.String()
|
|
||||||
case time.Time:
|
case time.Time:
|
||||||
return val.Format("2006-01-02 15:04:05")
|
return val.Format("2006-01-02 15:04:05")
|
||||||
case time.Duration:
|
case time.Duration:
|
||||||
|
|||||||
@@ -206,22 +206,6 @@ func (table *Table) AddRow(fields ...any) {
|
|||||||
table.Entries = append(table.Entries, fields)
|
table.Entries = append(table.Entries, fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *Table) AddRowLate(fields ...any) {
|
|
||||||
table.AddRow(fields)
|
|
||||||
|
|
||||||
if !table.processed {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
row := make([]string, len(fields))
|
|
||||||
|
|
||||||
for idx, field := range fields {
|
|
||||||
row[idx] = any2string(field)
|
|
||||||
}
|
|
||||||
|
|
||||||
table.rows = append(table.rows, row)
|
|
||||||
}
|
|
||||||
|
|
||||||
// needed for json and yaml output
|
// needed for json and yaml output
|
||||||
func (table *Table) toMap() []map[string]any {
|
func (table *Table) toMap() []map[string]any {
|
||||||
raw := make([]map[string]any, len(table.Entries))
|
raw := make([]map[string]any, len(table.Entries))
|
||||||
|
|||||||
Reference in New Issue
Block a user