Skip to content

Commit

Permalink
Merge pull request #58 from gomicro/handle-no-repos
Browse files Browse the repository at this point in the history
return error for no repos found
  • Loading branch information
dan9186 authored Feb 28, 2022
2 parents 8944abd + 703982d commit f872880
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 4 additions & 0 deletions client/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down
5 changes: 0 additions & 5 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
5 changes: 0 additions & 5 deletions cmd/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit f872880

Please sign in to comment.