forked from exercism/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.go
More file actions
38 lines (33 loc) · 759 Bytes
/
debug.go
File metadata and controls
38 lines (33 loc) · 759 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
37
38
package cmd
import (
"fmt"
"net/http"
"time"
"github.com/exercism/cli/cli"
"github.com/exercism/cli/config"
"github.com/exercism/cli/paths"
app "github.com/urfave/cli"
)
// Debug provides information about the user's environment and configuration.
func Debug(ctx *app.Context) error {
cli.HTTPClient = &http.Client{Timeout: 20 * time.Second}
c := cli.New(ctx.App.Version)
cfg, err := config.New(ctx.GlobalString("config"))
if err != nil {
return err
}
uc := config.UserConfig{
Path: cfg.File,
Home: paths.Home,
Workspace: cfg.Dir,
Token: cfg.APIKey,
}
status := cli.NewStatus(c, uc)
status.Censor = !ctx.Bool("full-api-key")
s, err := status.Check()
if err != nil {
return err
}
fmt.Println(s)
return nil
}