Skip to content

Commit

Permalink
Table headers are now FirstLetter case
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyworld committed Oct 11, 2016
1 parent 846a9fa commit a7a9348
Show file tree
Hide file tree
Showing 47 changed files with 158 additions and 158 deletions.
4 changes: 2 additions & 2 deletions cmd/juju/action/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/juju/cmd"
errors "github.com/juju/errors"
"github.com/juju/errors"
"github.com/juju/gnuflag"
"github.com/juju/utils"
"gopkg.in/juju/names.v2"
Expand Down Expand Up @@ -145,7 +145,7 @@ func (c *listCommand) printTabular(writer io.Writer, value interface{}) error {
}

tw := output.TabWriter(writer)
fmt.Fprintf(tw, "%s\t%s\n", "ACTION", "DESCRIPTION")
fmt.Fprintf(tw, "%s\t%s\n", "Action", "Description")
for _, value := range list {
fmt.Fprintf(tw, "%s\t%s\n", value.action, strings.TrimSpace(value.description))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/action/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *ListSuite) TestInit(c *gc.C) {

func (s *ListSuite) TestRun(c *gc.C) {
simpleOutput := `
ACTION DESCRIPTION
Action Description
kill Kill the database.
no-description No description
no-params An action with no parameters.
Expand Down
4 changes: 2 additions & 2 deletions cmd/juju/block/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func formatBlocks(writer io.Writer, value interface{}) error {

tw := output.TabWriter(writer)
w := output.Wrapper{tw}
w.Println("DISABLED COMMANDS", "MESSAGE")
w.Println("Disabled commands", "Message")
for _, info := range blocks {
w.Println(info.Commands, info.Message)
}
Expand Down Expand Up @@ -240,7 +240,7 @@ func FormatTabularBlockedModels(writer io.Writer, value interface{}) error {

tw := output.TabWriter(writer)
w := output.Wrapper{tw}
w.Println("NAME", "MODEL UUID", "OWNER", "DISABLED COMMANDS")
w.Println("Name", "Model UUID", "Owner", "Disabled commands")
for _, model := range models {
w.Println(model.Name, model.UUID, model.Owner, strings.Join(model.CommandSets, ", "))
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/juju/block/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (s *listCommandSuite) TestList(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(testing.Stderr(ctx), gc.Equals, "")
c.Assert(testing.Stdout(ctx), gc.Equals, ""+
"DISABLED COMMANDS MESSAGE\n"+
"Disabled commands Message\n"+
"destroy-model Sysadmins in control.\n"+
"all just temporary\n"+
"\n",
Expand Down Expand Up @@ -119,7 +119,7 @@ func (s *listCommandSuite) TestListAll(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(testing.Stderr(ctx), gc.Equals, "")
c.Assert(testing.Stdout(ctx), gc.Equals, ""+
"NAME MODEL UUID OWNER DISABLED COMMANDS\n"+
"Name Model UUID Owner Disabled commands\n"+
"controller fake-uuid-1 admin destroy-model, remove-object\n"+
"model-a fake-uuid-2 bob@external all\n"+
"model-b fake-uuid-3 charlie@external all, destroy-model\n"+
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/cloud/regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (c *listRegionsCommand) Run(ctxt *cmd.Context) error {
}

if len(cloud.Regions) == 0 {
fmt.Fprintln(ctxt.GetStdout(), "Cloud %q has no regions defined.", c.cloudName)
fmt.Fprintf(ctxt.GetStdout(), "Cloud %q has no regions defined.\n", c.cloudName)
return nil
}
var regions interface{}
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/controller/addmodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (c *addModelCommand) unsupportedCloudOrRegionError(cloudClient CloudAPI, de

var buf bytes.Buffer
tw := output.TabWriter(&buf)
fmt.Fprintln(tw, "CLOUD\tREGIONS")
fmt.Fprintln(tw, "Cloud\tRegions")
for _, cloudName := range cloudNames {
cloud := clouds[names.NewCloudTag(cloudName)]
regionNames := make([]string, len(cloud.Regions))
Expand Down
4 changes: 2 additions & 2 deletions cmd/juju/controller/addmodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (s *AddModelSuite) TestNoDefaultCloudRegion(c *gc.C) {
and there is no default cloud. The clouds/regions supported
by this controller are:
CLOUD REGIONS
Cloud Regions
aws us-east-1, us-west-1
lxd
`[1:])
Expand All @@ -264,7 +264,7 @@ func (s *AddModelSuite) TestInvalidCloudOrRegionName(c *gc.C) {
nor a region in the controller's default cloud "aws".
The clouds/regions supported by this controller are:
CLOUD REGIONS
Cloud Regions
aws us-east-1, us-west-1
lxd
`[1:])
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/controller/destroy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ func (s *DestroySuite) TestDestroyReturnsBlocks(c *gc.C) {
}
ctx, _ := s.runDestroyCommand(c, "test1", "-y", "--destroy-all-models")
c.Assert(testing.Stderr(ctx), gc.Equals, "Destroying controller\n"+
"NAME MODEL UUID OWNER DISABLED COMMANDS\n"+
"Name Model UUID Owner Disabled commands\n"+
"test1 1871299e-1370-4f3e-83ab-1849ed7b1076 cheryl destroy-model\n"+
"test2 c59d0e3b-2bd7-4867-b1b9-f1ef8a0bb004 bob all, destroy-model\n")
c.Assert(testing.Stdout(ctx), gc.Equals, "")
Expand Down
6 changes: 3 additions & 3 deletions cmd/juju/controller/listcontrollers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *ListControllersSuite) TestListControllers(c *gc.C) {
s.expectedOutput = `
Use --refresh to see the latest information.
CONTROLLER MODEL USER ACCESS CLOUD/REGION MODELS MACHINES HA VERSION
Controller Model User Access Cloud/Region Models Machines HA Version
aws-test controller - - aws/us-east-1 2 5 - 2.0.1
mallards* my-model admin superuser mallards/mallards1 - - - (unknown)
mark-test-prodstack - admin (unknown) prodstack - - - (unknown)
Expand All @@ -65,7 +65,7 @@ func (s *ListControllersSuite) TestListControllersRefresh(c *gc.C) {
return fakeController
}
s.expectedOutput = `
CONTROLLER MODEL USER ACCESS CLOUD/REGION MODELS MACHINES HA VERSION
Controller Model User Access Cloud/Region Models Machines HA Version
aws-test controller admin (unknown) aws/us-east-1 1 2 - 2.0.1
mallards* my-model admin superuser mallards/mallards1 2 4 - (unknown)
mark-test-prodstack - admin (unknown) prodstack - - - (unknown)
Expand Down Expand Up @@ -115,7 +115,7 @@ func (s *ListControllersSuite) TestListControllersKnownHAStatus(c *gc.C) {
s.createTestClientStore(c)
s.setupAPIForControllerMachines()
s.expectedOutput = `
CONTROLLER MODEL USER ACCESS CLOUD/REGION MODELS MACHINES HA VERSION
Controller Model User Access Cloud/Region Models Machines HA Version
aws-test controller admin (unknown) aws/us-east-1 1 2 1/3 2.0.1
mallards* my-model admin superuser mallards/mallards1 2 4 none (unknown)
mark-test-prodstack - admin (unknown) prodstack - - - (unknown)
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/controller/listcontrollersformatters.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func formatControllersTabular(writer io.Writer, set ControllerSet, promptRefresh
fmt.Fprintln(writer, "Use --refresh to see the latest information.")
fmt.Fprintln(writer)
}
w.Println("CONTROLLER", "MODEL", "USER", "ACCESS", "CLOUD/REGION", "MODELS", "MACHINES", "HA", "VERSION")
w.Println("Controller", "Model", "User", "Access", "Cloud/Region", "Models", "Machines", "HA", "Version")
tw.SetColumnAlignRight(5)
tw.SetColumnAlignRight(6)
tw.SetColumnAlignRight(7)
Expand Down
8 changes: 4 additions & 4 deletions cmd/juju/controller/listmodels.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ func (c *modelsCommand) formatTabular(writer io.Writer, value interface{}) error

tw := output.TabWriter(writer)
w := output.Wrapper{tw}
w.Println("CONTROLLER: " + c.ControllerName())
w.Println("Controller: " + c.ControllerName())
w.Println()
w.Print("MODEL")
w.Print("Model")
if c.listUUID {
w.Print("UUID")
}
Expand All @@ -282,15 +282,15 @@ func (c *modelsCommand) formatTabular(writer io.Writer, value interface{}) error
}
}
if haveMachineInfo {
w.Println("OWNER", "STATUS", "MACHINES", "CORES", "ACCESS", "LAST CONNECTION")
w.Println("Owner", "Status", "Machines", "Cores", "Access", "Last connection")
offset := 0
if c.listUUID {
offset++
}
tw.SetColumnAlignRight(3 + offset)
tw.SetColumnAlignRight(4 + offset)
} else {
w.Println("OWNER", "STATUS", "ACCESS", "LAST CONNECTION")
w.Println("Owner", "Status", "Access", "Last connection")
}
for _, model := range modelSet.Models {
owner := names.NewUserTag(model.Owner)
Expand Down
24 changes: 12 additions & 12 deletions cmd/juju/controller/listmodels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ func (s *ModelsSuite) TestModelsOwner(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.api.user, gc.Equals, "admin")
c.Assert(testing.Stdout(context), gc.Equals, ""+
"CONTROLLER: fake\n"+
"Controller: fake\n"+
"\n"+
"MODEL OWNER STATUS ACCESS LAST CONNECTION\n"+
"Model Owner Status Access Last connection\n"+
"test-model1* admin active read 2015-03-20\n"+
"carlotta/test-model2 carlotta active write 2015-03-01\n"+
"daiwik@external/test-model3 daiwik@external destroying never connected\n"+
Expand All @@ -164,9 +164,9 @@ func (s *ModelsSuite) TestModelsNonOwner(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.api.user, gc.Equals, "bob")
c.Assert(testing.Stdout(context), gc.Equals, ""+
"CONTROLLER: fake\n"+
"Controller: fake\n"+
"\n"+
"MODEL OWNER STATUS ACCESS LAST CONNECTION\n"+
"Model Owner Status Access Last connection\n"+
"admin/test-model1* admin active read 2015-03-20\n"+
"carlotta/test-model2 carlotta active write 2015-03-01\n"+
"daiwik@external/test-model3 daiwik@external destroying never connected\n"+
Expand All @@ -178,9 +178,9 @@ func (s *ModelsSuite) TestAllModels(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.api.all, jc.IsTrue)
c.Assert(testing.Stdout(context), gc.Equals, ""+
"CONTROLLER: fake\n"+
"Controller: fake\n"+
"\n"+
"MODEL OWNER STATUS ACCESS LAST CONNECTION\n"+
"Model Owner Status Access Last connection\n"+
"admin/test-model1* admin active read 2015-03-20\n"+
"carlotta/test-model2 carlotta active write 2015-03-01\n"+
"daiwik@external/test-model3 daiwik@external destroying never connected\n"+
Expand All @@ -192,9 +192,9 @@ func (s *ModelsSuite) TestAllModelsNoneCurrent(c *gc.C) {
context, err := testing.RunCommand(c, s.newCommand())
c.Assert(err, jc.ErrorIsNil)
c.Assert(testing.Stdout(context), gc.Equals, ""+
"CONTROLLER: fake\n"+
"Controller: fake\n"+
"\n"+
"MODEL OWNER STATUS ACCESS LAST CONNECTION\n"+
"Model Owner Status Access Last connection\n"+
"test-model1 admin active read 2015-03-20\n"+
"carlotta/test-model2 carlotta active write 2015-03-01\n"+
"daiwik@external/test-model3 daiwik@external destroying never connected\n"+
Expand All @@ -207,9 +207,9 @@ func (s *ModelsSuite) TestModelsUUID(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.api.user, gc.Equals, "admin")
c.Assert(testing.Stdout(context), gc.Equals, ""+
"CONTROLLER: fake\n"+
"Controller: fake\n"+
"\n"+
"MODEL UUID OWNER STATUS MACHINES CORES ACCESS LAST CONNECTION\n"+
"Model UUID Owner Status Machines Cores Access Last connection\n"+
"test-model1* test-model1-UUID admin active 2 1 read 2015-03-20\n"+
"carlotta/test-model2 test-model2-UUID carlotta active 0 - write 2015-03-01\n"+
"daiwik@external/test-model3 test-model3-UUID daiwik@external destroying 0 - never connected\n"+
Expand All @@ -222,9 +222,9 @@ func (s *ModelsSuite) TestModelsMachineInfo(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.api.user, gc.Equals, "admin")
c.Assert(testing.Stdout(context), gc.Equals, ""+
"CONTROLLER: fake\n"+
"Controller: fake\n"+
"\n"+
"MODEL OWNER STATUS MACHINES CORES ACCESS LAST CONNECTION\n"+
"Model Owner Status Machines Cores Access Last connection\n"+
"test-model1* admin active 2 1 read 2015-03-20\n"+
"carlotta/test-model2 carlotta active 0 - write 2015-03-01\n"+
"daiwik@external/test-model3 daiwik@external destroying 0 - never connected\n"+
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/machine/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (s *MachineListCommandSuite) TestMachine(c *gc.C) {
context, err := testing.RunCommand(c, newMachineListCommand())
c.Assert(err, jc.ErrorIsNil)
c.Assert(testing.Stdout(context), gc.Equals, ""+
"MACHINE STATE DNS INS-ID SERIES AZ\n"+
"Machine State DNS Inst id Series AZ\n"+
"0 started 10.0.0.1 juju-badd06-0 trusty us-east-1\n"+
"1 started 10.0.0.2 juju-badd06-1 trusty \n"+
"1/lxd/0 pending 10.0.0.3 juju-badd06-1-lxd-0 trusty \n"+
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/machine/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *MachineShowCommandSuite) TestShowTabularMachine(c *gc.C) {
context, err := testing.RunCommand(c, newMachineShowCommand(), "--format", "tabular", "0", "1")
c.Assert(err, jc.ErrorIsNil)
c.Assert(testing.Stdout(context), gc.Equals, ""+
"MACHINE STATE DNS INS-ID SERIES AZ\n"+
"Machine State DNS Inst id Series AZ\n"+
"0 started 10.0.0.1 juju-badd06-0 trusty us-east-1\n"+
"1 started 10.0.0.2 juju-badd06-1 trusty \n"+
"1/lxd/0 pending 10.0.0.3 juju-badd06-1-lxd-0 trusty \n"+
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/model/configcommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func formatConfigTabular(writer io.Writer, value interface{}) error {
valueNames = append(valueNames, name)
}
sort.Strings(valueNames)
w.Println("ATTRIBUTE", "FROM", "VALUE")
w.Println("Attribute", "From", "Value")

for _, name := range valueNames {
info := configValues[name]
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/model/configcommand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (s *ConfigCommandSuite) TestAllValuesTabular(c *gc.C) {

output := testing.Stdout(context)
expected := "" +
"ATTRIBUTE FROM VALUE\n" +
"Attribute From Value\n" +
"running model true\n" +
"special model special value\n" +
"\n"
Expand Down
4 changes: 2 additions & 2 deletions cmd/juju/romulus/listplans/list_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func formatSummary(writer io.Writer, value interface{}) error {
}
fmt.Fprintln(tw)
}
p("PLAN", "PRICE")
p("Plan", "Price")
for _, plan := range plans {
p(plan.URL, plan.Price)
}
Expand All @@ -188,7 +188,7 @@ func formatTabular(writer io.Writer, value interface{}) error {
table.MaxColWidth = 50
table.Wrap = true

table.AddRow("PLAN", "PRICE", "DESCRIPTION")
table.AddRow("Plan", "Price", "Description")
for _, plan := range plans {
table.AddRow(plan.URL, plan.Price, plan.Description)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/romulus/listplans/list_plans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *ListPlansCommandSuite) TestTabularOutput(c *gc.C) {
ctx, err := cmdtesting.RunCommand(c, listPlans, "some-charm-url")
c.Assert(err, jc.ErrorIsNil)
c.Assert(cmdtesting.Stdout(ctx), gc.Equals,
`PLAN PRICE DESCRIPTION
`Plan Price Description
bob/test-plan-1 Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Nunc pretium purus nec magna faucibus, sed
Expand Down
4 changes: 2 additions & 2 deletions cmd/juju/space/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (c *listCommand) printTabular(writer io.Writer, value interface{}) error {
if !ok {
return errors.New("unexpected value")
}
fmt.Fprintf(tw, "SPACE\n")
fmt.Fprintln(tw, "Space")
spaces := list.Spaces
sort.Strings(spaces)
for _, space := range spaces {
Expand All @@ -158,7 +158,7 @@ func (c *listCommand) printTabular(writer io.Writer, value interface{}) error {
return errors.New("unexpected value")
}

fmt.Fprintf(tw, "%s\t%s\n", "SPACE", "SUBNETS")
fmt.Fprintf(tw, "%s\t%s\n", "Space", "Subnets")
spaces := []string{}
for name, _ := range list.Spaces {
spaces = append(spaces, name)
Expand Down
4 changes: 2 additions & 2 deletions cmd/juju/space/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ spaces:
}
`, "") + "\n"

expectedTabular := `SPACE SUBNETS
expectedTabular := `Space Subnets
space1 2001:db8::/32
invalid
space2 10.1.2.0/24
4.3.2.0/28
`
expectedShortTabular := `SPACE
expectedShortTabular := `Space
space1
space2
Expand Down
6 changes: 3 additions & 3 deletions cmd/juju/status/output_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ func FormatSummary(writer io.Writer, value interface{}) error {

// Right align summary information
f.tw.Init(writer, 0, 1, 2, ' ', tabwriter.AlignRight)
p("# MACHINES:", fmt.Sprintf("(%d)", len(fs.Machines)))
p("# Machines:", fmt.Sprintf("(%d)", len(fs.Machines)))
f.printStateToCount(stateToMachine)
p(" ")

p("# UNITS:", fmt.Sprintf("(%d)", f.numUnits))
p("# Units:", fmt.Sprintf("(%d)", f.numUnits))
f.printStateToCount(f.stateToUnit)
p(" ")

p("# APPLICATIONS:", fmt.Sprintf("(%d)", len(fs.Applications)))
p("# Applications:", fmt.Sprintf("(%d)", len(fs.Applications)))
for _, svcName := range utils.SortStringsNaturally(stringKeysFromMap(svcExposure)) {
s := svcExposure[svcName]
p(svcName, fmt.Sprintf("%d/%d\texposed", s[true], s[true]+s[false]))
Expand Down
Loading

0 comments on commit a7a9348

Please sign in to comment.