Skip to content

Commit bf9fe36

Browse files
committed
feat: students and groups on the command line are now regexps
1 parent 2f39855 commit bf9fe36

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

config/students.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package config
22

33
import (
4+
"regexp"
45
"sort"
56
"strconv"
67
"strings"
@@ -58,8 +59,8 @@ func students(per Per, course, assignment string, onlyForStudentsOrGroups ...str
5859
onlyForStudents := make([]string, 0, len(onlyForStudentsOrGroups))
5960
for _, onlyStudent := range onlyForStudentsOrGroups {
6061
for _, student := range studs {
61-
if onlyStudent == student {
62-
onlyForStudents = append(onlyForStudents, onlyStudent)
62+
if ok, err := regexp.MatchString(onlyStudent, student); ok && err == nil {
63+
onlyForStudents = append(onlyForStudents, student)
6364
}
6465
}
6566
}
@@ -123,7 +124,7 @@ func groups(per Per, course, assignment string, onlyForStudentsOrGroups ...strin
123124
onlyTheseGroups := make(map[string][]string)
124125
for _, onlyGroup := range onlyForStudentsOrGroups {
125126
for groupname, students := range groupsMap {
126-
if onlyGroup == groupname {
127+
if ok, err := regexp.MatchString(onlyGroup, groupname); ok && err == nil {
127128
onlyTheseGroups[groupname] = students
128129
}
129130
}

0 commit comments

Comments
 (0)