Concatenating the output instead of printing twice

This commit is contained in:
vishalnayak 2016-06-20 15:26:33 -04:00
parent 91668dd21d
commit 9be9f73806
2 changed files with 5 additions and 3 deletions

View File

@ -176,7 +176,7 @@ func (t TableFormatter) OutputSecret(ui cli.Ui, secret, s *api.Secret) error {
input = append(input, fmt.Sprintf("%s %s %v", k, config.Delim, s.Data[k]))
}
ui.Output(columnize.Format(input, config))
tableOutputStr := columnize.Format(input, config)
// Print the warning separately because the length of first
// column in the output will be increased by the length of
@ -190,7 +190,9 @@ func (t TableFormatter) OutputSecret(ui cli.Ui, secret, s *api.Secret) error {
}
}
ui.Output(columnize.Format(warningsInput, config))
warningsOutputStr := columnize.Format(warningsInput, config)
ui.Output(fmt.Sprintf("%s\n%s", tableOutputStr, warningsOutputStr))
return nil
}

View File

@ -77,6 +77,6 @@ func TestTableFormatter(t *testing.T) {
t.Fatal(err)
}
if !strings.Contains(output, "something") {
t.Fatal("did not find something")
t.Fatal("did not find 'something'")
}
}