go/clitable: factor out from metroctl
We need the same functionality in bmcli, so factor it out from metroctl
into a generic library.
Change-Id: I3fb3dfaae44a64d204e9220f117f379c382c5c4f
Reviewed-on: https://review.monogon.dev/c/monogon/+/2172
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/cli/metroctl/cmd_node.go b/metropolis/cli/metroctl/cmd_node.go
index b9692b6..1e4afa5 100644
--- a/metropolis/cli/metroctl/cmd_node.go
+++ b/metropolis/cli/metroctl/cmd_node.go
@@ -11,6 +11,7 @@
"github.com/spf13/cobra"
+ "source.monogon.dev/go/clitable"
"source.monogon.dev/metropolis/cli/metroctl/core"
clicontext "source.monogon.dev/metropolis/cli/pkg/context"
"source.monogon.dev/metropolis/node/core/identity"
@@ -173,7 +174,7 @@
}
}
- var t table
+ var t clitable.Table
for _, n := range nodes {
// Filter the information we want client-side.
if len(qids) != 0 {
@@ -182,8 +183,8 @@
continue
}
}
- t.add(nodeEntry(n))
+ t.Add(nodeEntry(n))
}
- t.print(o, onlyColumns)
+ t.Print(o, onlyColumns)
}