@@ -124,13 +124,15 @@ func listAction(cmd *cobra.Command, args []string) error {
124
124
}
125
125
126
126
instanceNames := []string {}
127
+ unmatchedInstances := false
127
128
if len (args ) > 0 {
128
129
for _ , arg := range args {
129
130
matches := instanceMatches (arg , allinstances )
130
131
if len (matches ) > 0 {
131
132
instanceNames = append (instanceNames , matches ... )
132
133
} else {
133
- return fmt .Errorf ("no instance matching %v found" , arg )
134
+ logrus .Warnf ("No instance matching %v found." , arg )
135
+ unmatchedInstances = true
134
136
}
135
137
}
136
138
} else {
@@ -141,6 +143,9 @@ func listAction(cmd *cobra.Command, args []string) error {
141
143
for _ , instName := range instanceNames {
142
144
fmt .Fprintln (cmd .OutOrStdout (), instName )
143
145
}
146
+ if unmatchedInstances {
147
+ os .Exit (1 )
148
+ }
144
149
return nil
145
150
}
146
151
@@ -174,7 +179,12 @@ func listAction(cmd *cobra.Command, args []string) error {
174
179
}
175
180
}
176
181
}
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
178
188
}
179
189
180
190
func listBashComplete (cmd * cobra.Command , _ []string , _ string ) ([]string , cobra.ShellCompDirective ) {
0 commit comments