Skip to content

Commit

Permalink
Adjusted naming from text to table for printer type
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Huanca committed Mar 29, 2019
1 parent 27a52d1 commit c445f33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/capacity/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import (
)

const (
//TextOutput is the constant value for output type text
TextOutput string = "text"
//TableOutput is the constant value for output type text
TableOutput string = "table"
//JSONOutput is the constant value for output type text
JSONOutput string = "json"
)

// SupportedOutputs returns a string list of output formats supposed by this package
func SupportedOutputs() []string {
return []string{
TextOutput,
TableOutput,
JSONOutput,
}
}
Expand Down Expand Up @@ -58,8 +58,8 @@ func printerFactory(cm *clusterMetric, showPods bool, showUtil bool, outputType
showUtil: showUtil,
}
return response, nil
case TextOutput:
response = textPrinter{
case TableOutput:
response = tablePrinter{
cm: cm,
showPods: showPods,
showUtil: showUtil,
Expand Down
8 changes: 4 additions & 4 deletions pkg/capacity/text.go → pkg/capacity/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"text/tabwriter"
)

type textPrinter struct {
type tablePrinter struct {
cm *clusterMetric
showPods bool
showUtil bool
w *tabwriter.Writer
}

func (tp textPrinter) Print() {
func (tp tablePrinter) Print() {
tp.w.Init(os.Stdout, 0, 8, 2, ' ', 0)
names := make([]string, len(tp.cm.nodeMetrics))

Expand All @@ -35,7 +35,7 @@ func (tp textPrinter) Print() {
tp.w.Flush()
}

func (tp *textPrinter) printHeaders() {
func (tp *tablePrinter) printHeaders() {
if tp.showPods && tp.showUtil {
fmt.Fprintln(tp.w, "NODE\t NAMESPACE\t POD\t CPU REQUESTS \t CPU LIMITS \t CPU UTIL \t MEMORY REQUESTS \t MEMORY LIMITS \t MEMORY UTIL")

Expand Down Expand Up @@ -83,7 +83,7 @@ func (tp *textPrinter) printHeaders() {
}
}

func (tp *textPrinter) printNode(name string, nm *nodeMetric) {
func (tp *tablePrinter) printNode(name string, nm *nodeMetric) {
podNames := make([]string, len(nm.podMetrics))

i := 0
Expand Down

0 comments on commit c445f33

Please sign in to comment.