Skip to content

Commit f872880

Browse files
authored
Merge pull request #58 from gomicro/handle-no-repos
return error for no repos found
2 parents 8944abd + 703982d commit f872880

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

client/repos.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ func (c *Client) GetRepos(ctx context.Context, name string) ([]*github.Repositor
4545
count = org.GetPublicRepos() + org.GetTotalPrivateRepos()
4646
}
4747

48+
if count < 1 {
49+
return nil, fmt.Errorf("no repos found")
50+
}
51+
4852
repoBar := uiprogress.AddBar(count).
4953
AppendCompleted().
5054
PrependElapsed().

cmd/create.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ func createFunc(cmd *cobra.Command, args []string) {
4545
os.Exit(1)
4646
}
4747

48-
if len(repos) < 1 {
49-
fmt.Printf("github: no repos found\n")
50-
return
51-
}
52-
5348
urls, err := clt.ProcessRepos(ctx, repos, dryRun)
5449
if err != nil {
5550
fmt.Printf("process repos: %v\n", err.Error())

cmd/release.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ func orgReleaseFunc(cmd *cobra.Command, args []string) {
4141
os.Exit(1)
4242
}
4343

44-
if len(repos) < 1 {
45-
fmt.Println("github: no repos found")
46-
return
47-
}
48-
4944
urls, err := clt.ReleaseRepos(ctx, repos, dryRun)
5045
if err != nil {
5146
fmt.Printf("releasing: %v\n", err.Error())

0 commit comments

Comments
 (0)