Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(urls): urls without groups or students prints the assignment url #36

Merged
merged 2 commits into from
Nov 5, 2024
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ This is useful for opening the webpages using a pipe, e.g.,
glabs urls algdati blatt3 grp15 | xargs open
```

`urls` without groups or students prints the assignment url.

## Seeding using a custom tool

Instead of providing each student/group the same repository using the startercode option it is possible to run a tool to seed each repository individually.
Expand Down
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
Loading