@@ -124,13 +124,15 @@ func listAction(cmd *cobra.Command, args []string) error {
124124 }
125125
126126 instanceNames := []string {}
127+ unmatchedInstances := false
127128 if len (args ) > 0 {
128129 for _ , arg := range args {
129130 matches := instanceMatches (arg , allinstances )
130131 if len (matches ) > 0 {
131132 instanceNames = append (instanceNames , matches ... )
132133 } else {
133- return fmt .Errorf ("no instance matching %v found" , arg )
134+ logrus .Warnf ("No instance matching %v found." , arg )
135+ unmatchedInstances = true
134136 }
135137 }
136138 } else {
@@ -141,6 +143,9 @@ func listAction(cmd *cobra.Command, args []string) error {
141143 for _ , instName := range instanceNames {
142144 fmt .Fprintln (cmd .OutOrStdout (), instName )
143145 }
146+ if unmatchedInstances {
147+ os .Exit (1 )
148+ }
144149 return nil
145150 }
146151
@@ -174,7 +179,12 @@ func listAction(cmd *cobra.Command, args []string) error {
174179 }
175180 }
176181 }
177- return store .PrintInstances (out , instances , format , & options )
182+
183+ err = store .PrintInstances (out , instances , format , & options )
184+ if err == nil && unmatchedInstances {
185+ os .Exit (1 )
186+ }
187+ return err
178188}
179189
180190func listBashComplete (cmd * cobra.Command , _ []string , _ string ) ([]string , cobra.ShellCompDirective ) {
0 commit comments