Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Fix update repo when all option selected #700

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/cmd/update_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ func (up updateRepoCmd) runPrompt() CommandRunnerFunc {
}

var reposName []string
var externalRepos formula.Repos
reposName = append(reposName, updateOptionAll)
for i := range repos {
if !repos[i].IsLocal {
externalRepos = append(externalRepos, repos[i])
reposName = append(reposName, repos[i].Name.String())
}
}
Expand All @@ -106,9 +108,9 @@ func (up updateRepoCmd) runPrompt() CommandRunnerFunc {
var repoToUpdate []formula.Repo

if flagAll {
repoToUpdate = repos
repoToUpdate = externalRepos
} else {
for i := range repos {
for i := range externalRepos {
if repos[i].Name == formula.RepoName(name) {
repoToUpdate = append(repoToUpdate, repos[i])
break
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/update_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestUpdateRepoRun(t *testing.T) {
Url: "https://github.com/owner/repo",
Token: "token",
Priority: 1,
IsLocal: true,
}

type in struct {
Expand Down