Skip to content

Commit 79eee46

Browse files
committed
Merge pull request #20 from Tonkpils/current-assignment
Print current exercises
2 parents 3ea47dc + 3b3b73f commit 79eee46

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

main.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ func main() {
1515
app.Usage = "A command line tool to interact with http://exercism.io"
1616
app.Version = VERSION
1717
app.Commands = []cli.Command{
18+
{
19+
Name: "current",
20+
ShortName: "c",
21+
Usage: "Show the current assignments",
22+
Action: func(c *cli.Context) {
23+
config, err := ConfigFromFile(HomeDir())
24+
if err != nil {
25+
fmt.Println("Are you sure you are logged in? Please login again.")
26+
return
27+
}
28+
currentAssignments, err := FetchAssignments(config, FetchEndpoints["current"])
29+
if err != nil {
30+
fmt.Println(err)
31+
return
32+
}
33+
34+
fmt.Println("Current Assignments")
35+
36+
for _, a := range currentAssignments {
37+
fmt.Printf("%v: %v\n", strings.Title(a.Track), a.Slug)
38+
}
39+
},
40+
},
1841
{
1942
Name: "demo",
2043
ShortName: "d",

0 commit comments

Comments
 (0)