cmd/ghcs/delete: When matching repos to delete, standardize casing

- It was possible to delete Codespaces for repo `SomePerson/foo` but not
  `someperson/foo`, despite the fact that the GitHub APIs don't actually
  care about casing - `SomePerson` and `someperson` is the same account.
- This fixes that by lowercasing both the user-provided repo name, and
  the repository that is attached to the Codespace for a match.
- Fixes #76.
This commit is contained in:
Issy Long 2021-08-18 18:05:59 +01:00
parent 00502e9263
commit 5af1cccb73

View file

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strings"
"github.com/github/ghcs/api"
"github.com/github/ghcs/cmd/ghcs/output"
@ -124,7 +125,7 @@ func DeleteByRepo(repo string) error {
var deleted bool
for _, c := range codespaces {
if c.RepositoryNWO != repo {
if strings.ToLower(c.RepositoryNWO) != strings.ToLower(repo) {
continue
}
deleted = true