-
-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathunsubmit.go
More file actions
31 lines (25 loc) · 608 Bytes
/
unsubmit.go
File metadata and controls
31 lines (25 loc) · 608 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 (
"fmt"
"log"
"github.com/codegangsta/cli"
"github.com/exercism/cli/api"
"github.com/exercism/cli/config"
)
// Unsubmit deletes an iteration from the api.
// If no iteration is specified, the most recent iteration
// is deleted.
func Unsubmit(ctx *cli.Context) {
c, err := config.New(ctx.GlobalString("config"))
if err != nil {
log.Fatal(err)
}
if !c.IsAuthenticated() {
log.Fatal(msgPleaseAuthenticate)
}
client := api.NewClient(c)
if err := client.Unsubmit(); err != nil {
log.Fatal(err)
}
fmt.Println("Your most recent submission was successfully deleted.")
}