fix: output available machine names on --machine error

This commit is contained in:
Camilo Garcia La Rotta 2021-07-22 10:07:09 -04:00
parent a68cda1469
commit 3ef0226e20

View file

@ -161,7 +161,13 @@ func getMachineName(ctx context.Context, user *api.User, repo *api.Repository, l
return machine, nil
}
}
return "", fmt.Errorf("there are is no such machine for the repository: %s", machine)
availableSkus := make([]string, len(skus))
for i := 0; i < len(skus); i++ {
availableSkus[i] = skus[i].Name
}
return "", fmt.Errorf("there are is no such machine for the repository: %s\nAvailable machines: %v", machine, availableSkus)
} else if len(skus) == 0 {
return "", nil
}