From 703982d9e138aaf28b878b990d5880cf542e6559 Mon Sep 17 00:00:00 2001 From: Daniel Hess Date: Mon, 28 Feb 2022 13:00:32 -0800 Subject: [PATCH] return error for no repos found --- client/repos.go | 4 ++++ cmd/create.go | 5 ----- cmd/release.go | 5 ----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/client/repos.go b/client/repos.go index 322c23d..4d8b461 100644 --- a/client/repos.go +++ b/client/repos.go @@ -45,6 +45,10 @@ func (c *Client) GetRepos(ctx context.Context, name string) ([]*github.Repositor count = org.GetPublicRepos() + org.GetTotalPrivateRepos() } + if count < 1 { + return nil, fmt.Errorf("no repos found") + } + repoBar := uiprogress.AddBar(count). AppendCompleted(). PrependElapsed(). diff --git a/cmd/create.go b/cmd/create.go index 42f1996..4e75481 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -45,11 +45,6 @@ func createFunc(cmd *cobra.Command, args []string) { os.Exit(1) } - if len(repos) < 1 { - fmt.Printf("github: no repos found\n") - return - } - urls, err := clt.ProcessRepos(ctx, repos, dryRun) if err != nil { fmt.Printf("process repos: %v\n", err.Error()) diff --git a/cmd/release.go b/cmd/release.go index 63b5d4f..15d7fa2 100644 --- a/cmd/release.go +++ b/cmd/release.go @@ -41,11 +41,6 @@ func orgReleaseFunc(cmd *cobra.Command, args []string) { os.Exit(1) } - if len(repos) < 1 { - fmt.Println("github: no repos found") - return - } - urls, err := clt.ReleaseRepos(ctx, repos, dryRun) if err != nil { fmt.Printf("releasing: %v\n", err.Error())