Concatenating the output instead of printing twice
This commit is contained in:
parent
91668dd21d
commit
9be9f73806
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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'")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue