Skip to content

Commit 67d8422

Browse files
committed
Filter comments in the list file as well as empty lines.
It's handy to have comments in the list file so that you describe to other teams that may have different destination repos where to put actions to sync. closes #106 Signed-off-by: Bryan Hundven <[email protected]>
1 parent 4e43192 commit 67d8422

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)