formatter: minor refactor to reduce needless conversions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -8,9 +8,10 @@ import (
|
||||
|
||||
const (
|
||||
// KubernetesStackTableFormat is the default Kubernetes stack format
|
||||
KubernetesStackTableFormat = "table {{.Name}}\t{{.Services}}\t{{.Orchestrator}}\t{{.Namespace}}"
|
||||
KubernetesStackTableFormat formatter.Format = "table {{.Name}}\t{{.Services}}\t{{.Orchestrator}}\t{{.Namespace}}"
|
||||
|
||||
// SwarmStackTableFormat is the default Swarm stack format
|
||||
SwarmStackTableFormat = "table {{.Name}}\t{{.Services}}\t{{.Orchestrator}}"
|
||||
SwarmStackTableFormat formatter.Format = "table {{.Name}}\t{{.Services}}\t{{.Orchestrator}}"
|
||||
|
||||
stackServicesHeader = "SERVICES"
|
||||
stackOrchestrastorHeader = "ORCHESTRATOR"
|
||||
|
||||
@ -27,7 +27,7 @@ func TestStackContextWrite(t *testing.T) {
|
||||
},
|
||||
// Table format
|
||||
{
|
||||
formatter.Context{Format: formatter.Format(SwarmStackTableFormat)},
|
||||
formatter.Context{Format: SwarmStackTableFormat},
|
||||
`NAME SERVICES ORCHESTRATOR
|
||||
baz 2 orchestrator1
|
||||
bar 1 orchestrator2
|
||||
@ -35,7 +35,7 @@ bar 1 orchestrator2
|
||||
},
|
||||
// Kubernetes table format adds Namespace column
|
||||
{
|
||||
formatter.Context{Format: formatter.Format(KubernetesStackTableFormat)},
|
||||
formatter.Context{Format: KubernetesStackTableFormat},
|
||||
`NAME SERVICES ORCHESTRATOR NAMESPACE
|
||||
baz 2 orchestrator1 namespace1
|
||||
bar 1 orchestrator2 namespace2
|
||||
|
||||
Reference in New Issue
Block a user