-
-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathskip.go
More file actions
36 lines (29 loc) · 636 Bytes
/
skip.go
File metadata and controls
36 lines (29 loc) · 636 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
32
33
34
35
36
package cmd
import (
"fmt"
"log"
"github.com/codegangsta/cli"
"github.com/exercism/cli/api"
"github.com/exercism/cli/config"
)
// Skip allows a user to skip a specific problem.
func Skip(ctx *cli.Context) {
c, err := config.New(ctx.GlobalString("config"))
if err != nil {
log.Fatal(err)
}
args := ctx.Args()
if len(args) != 2 {
msg := "Usage: exercism skip TRACK_ID PROBLEM"
log.Fatal(msg)
}
var (
trackID = args[0]
slug = args[1]
)
client := api.NewClient(c)
if err := client.Skip(trackID, slug); err != nil {
log.Fatal(err)
}
fmt.Printf("Exercise %q in %q has been skipped.\n", slug, trackID)
}