From 3ef0226e20e64088c4755b7b91a0d02a5fccf697 Mon Sep 17 00:00:00 2001 From: Camilo Garcia La Rotta Date: Thu, 22 Jul 2021 10:07:09 -0400 Subject: [PATCH] fix: output available machine names on --machine error --- cmd/ghcs/create.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/ghcs/create.go b/cmd/ghcs/create.go index 128a5ea44..b23e5631b 100644 --- a/cmd/ghcs/create.go +++ b/cmd/ghcs/create.go @@ -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 }