Skip to content

Commit b87e721

Browse files
authored
Merge pull request #3543 from jandubois/list-err-not-found
Always return an error when a requested instance is not found
2 parents 353be89 + 9ac2fbc commit b87e721

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/limactl/list.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ func listAction(cmd *cobra.Command, args []string) error {
134134
logrus.Warnf("The directory %q does not look like a valid Lima directory: %v", store.Directory(), err)
135135
}
136136

137-
allinstances, err := store.Instances()
137+
allInstances, err := store.Instances()
138138
if err != nil {
139139
return err
140140
}
141-
if len(allinstances) == 0 {
141+
if len(args) == 0 && len(allInstances) == 0 {
142142
logrus.Warn("No instance found. Run `limactl create` to create an instance.")
143143
return nil
144144
}
@@ -147,7 +147,7 @@ func listAction(cmd *cobra.Command, args []string) error {
147147
unmatchedInstances := false
148148
if len(args) > 0 {
149149
for _, arg := range args {
150-
matches := instanceMatches(arg, allinstances)
150+
matches := instanceMatches(arg, allInstances)
151151
if len(matches) > 0 {
152152
instanceNames = append(instanceNames, matches...)
153153
} else {
@@ -156,7 +156,7 @@ func listAction(cmd *cobra.Command, args []string) error {
156156
}
157157
}
158158
} else {
159-
instanceNames = allinstances
159+
instanceNames = allInstances
160160
}
161161

162162
if quiet {

0 commit comments

Comments
 (0)