File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ package handlers
2+
3+ import (
4+ "fmt"
5+ "log"
6+ "os/user"
7+ "runtime"
8+
9+ "github.com/codegangsta/cli"
10+ "github.com/exercism/cli/config"
11+ )
12+
13+ func Debug (ctx * cli.Context ) {
14+ usr , err := user .Current ()
15+ if err != nil {
16+ log .Fatal (err )
17+ }
18+
19+ fmt .Printf ("Debug Information\n " )
20+ fmt .Printf ("OS/Architecture: %s/%s\n " , runtime .GOOS , runtime .GOARCH )
21+ fmt .Printf ("Home Dir: %s\n " , usr .HomeDir )
22+ fmt .Printf ("Version: %s\n " , ctx .App .Version )
23+
24+ file , err := config .FilePath (ctx .GlobalString ("config" ))
25+ if err != nil {
26+ log .Fatal (err )
27+ }
28+
29+ c , err := config .Read (file )
30+ if err == nil {
31+ fmt .Printf ("\n Exercism Configuration\n " )
32+ fmt .Printf ("API Key: %s\n " , c .APIKey )
33+ fmt .Printf ("Exercises Directory: %s\n " , c .Dir )
34+ fmt .Printf ("Config file: %s\n " , c .File ())
35+ fmt .Printf ("API: %s\n " , c .Hostname )
36+ }
37+
38+ fmt .Printf ("\n If you are having any issues, please contact kytrinyx@exercism.io with this information.\n " )
39+ }
Original file line number Diff line number Diff line change @@ -59,6 +59,11 @@ func main() {
5959 },
6060 }
6161 app .Commands = []cli.Command {
62+ {
63+ Name : "debug" ,
64+ Usage : "Outputs useful debug information." ,
65+ Action : handlers .Debug ,
66+ },
6267 {
6368 Name : "configure" ,
6469 Usage : "Write config values to a JSON file" ,
You can’t perform that action at this time.
0 commit comments