Fix an output bug in get-context

This fixes an issue where `airshipctl config get-context` would provide
no output when there were no contexts in the configuration.

Change-Id: I8eaafff8ecee7878f80d22867b0420feba1bf376
This commit is contained in:
Ian Howell 2020-01-27 12:08:34 -06:00
parent 0528b76b9c
commit 73f9eb383b
2 changed files with 3 additions and 2 deletions

View File

@ -95,8 +95,8 @@ func getContexts(out io.Writer, airconfig *config.Config) error {
if err != nil {
return err
}
if contexts == nil {
fmt.Fprint(out, "No Contexts found in the configuration.\n")
if len(contexts) == 0 {
fmt.Fprintln(out, "No Contexts found in the configuration.")
}
for _, context := range contexts {
fmt.Fprintf(out, "%s", context.PrettyString())

View File

@ -0,0 +1 @@
No Contexts found in the configuration.