-
-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathrestore.go
More file actions
31 lines (25 loc) · 557 Bytes
/
restore.go
File metadata and controls
31 lines (25 loc) · 557 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cmd
import (
"log"
"github.com/codegangsta/cli"
"github.com/exercism/cli/api"
"github.com/exercism/cli/config"
"github.com/exercism/cli/user"
)
// Restore returns a user's solved problems.
func Restore(ctx *cli.Context) {
c, err := config.New(ctx.GlobalString("config"))
if err != nil {
log.Fatal(err)
}
client := api.NewClient(c)
problems, err := client.Restore()
if err != nil {
log.Fatal(err)
}
hw := user.NewHomework(problems, c)
if err := hw.Save(); err != nil {
log.Fatal(err)
}
hw.Summarize(user.HWNotSubmitted)
}