Skip to content

Commit 11bc18f

Browse files
Merge pull request #107 from bhundven/filter_comments
Filter comments in the list file as well as empty lines.
2 parents 4e43192 + 67d8422 commit 11bc18f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/reponames.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func getRepoNamesFromCacheDir(flags *CommonFlags) ([]string, error) {
6262
}
6363

6464
func getRepoNamesFromCSVString(csv string) ([]string, error) {
65-
repos := filterEmptyEntries(strings.Split(csv, ","))
65+
repos := filterEntries(strings.Split(csv, ","))
6666
if len(repos) == 0 {
6767
return nil, ErrEmptyRepoList
6868
}
@@ -74,17 +74,17 @@ func getRepoNamesFromFile(file string) ([]string, error) {
7474
if err != nil {
7575
return nil, err
7676
}
77-
repos := filterEmptyEntries(strings.Split(string(data), "\n"))
77+
repos := filterEntries(strings.Split(string(data), "\n"))
7878
if len(repos) == 0 {
7979
return nil, ErrEmptyRepoList
8080
}
8181
return repos, nil
8282
}
8383

84-
func filterEmptyEntries(names []string) []string {
84+
func filterEntries(names []string) []string {
8585
filtered := []string{}
8686
for _, name := range names {
87-
if name != "" {
87+
if !strings.HasPrefix(name, "#") && len(name) > 0 {
8888
filtered = append(filtered, name)
8989
}
9090
}

0 commit comments

Comments
 (0)