Skip to content

Commit

Permalink
feat(urls): urls without groups or students prints the assignment url
Browse files Browse the repository at this point in the history
  • Loading branch information
obcode committed Nov 5, 2024
1 parent 6f20707 commit 8e6a726
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
Args: cobra.MinimumNArgs(2), //nolint:gomnd
Run: func(cmd *cobra.Command, args []string) {
assignmentConfig := config.GetAssignmentConfig(args[0], args[1], args[2:]...)
assignmentConfig.Urls()
assignmentConfig.Urls(len(args) == 2)
},
}
)
Expand Down
6 changes: 4 additions & 2 deletions config/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package config

import "fmt"

func (cfg *AssignmentConfig) Urls() {
if cfg.Per == PerStudent {
func (cfg *AssignmentConfig) Urls(assignment bool) {
if assignment {
fmt.Println(cfg.URL)
} else if cfg.Per == PerStudent {
for _, stud := range cfg.Students {
fmt.Printf("%s/%s-%s\n", cfg.URL, cfg.Name, cfg.RepoSuffix(stud))
}
Expand Down

0 comments on commit 8e6a726

Please sign in to comment.