From 5d665f4e7542ac42bf022fc050907e5e684826d2 Mon Sep 17 00:00:00 2001 From: Jack <56563911+jdockerty@users.noreply.github.com> Date: Tue, 6 Dec 2022 21:24:58 +0000 Subject: [PATCH] refactor: table format to constants (#19) This is a minor styling/semantics thing, as it does make more sense for them to be placed into constants rather than vars. --- cmd/plugin/cli/root.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/plugin/cli/root.go b/cmd/plugin/cli/root.go index 15f5f40..49d3209 100644 --- a/cmd/plugin/cli/root.go +++ b/cmd/plugin/cli/root.go @@ -34,13 +34,6 @@ var ( // Only 'time' is supported currently. sortField string - // When using the namespace provided by the `--namespace/-n` flag or current context. - // This represents: Pod, Container, Request, Limit, and Termination Time - singleNamespaceFormatting = "%s\t%s\t%s\t%s\t%s\n" - - // When using the `all-namespaces` flag, we must show which namespace the pod was in, this becomes an extra column. - // This represents: Namespace, Pod, Container, Request, Limit, and Termination Time - allNamespacesFormatting = "%s\t%s\t%s\t%s\t%s\t%s\n" // Formatting for table output, similar to other kubectl commands. t = tabwriter.NewWriter(os.Stdout, 10, 1, 5, ' ', 0) @@ -53,6 +46,14 @@ const ( // Sort by termination timestamp in ascending order. sortFieldTerminationTime = "time" + + // When using the namespace provided by the `--namespace/-n` flag or current context. + // This represents: Pod, Container, Request, Limit, and Termination Time + singleNamespaceFormatting = "%s\t%s\t%s\t%s\t%s\n" + + // When using the `all-namespaces` flag, we must show which namespace the pod was in, this becomes an extra column. + // This represents: Namespace, Pod, Container, Request, Limit, and Termination Time + allNamespacesFormatting = "%s\t%s\t%s\t%s\t%s\t%s\n" ) func RootCmd() *cobra.Command {