forked from direnv/direnv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd_status.go
42 lines (35 loc) · 974 Bytes
/
cmd_status.go
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
39
40
41
42
package main
import (
"fmt"
)
var CmdStatus = &Cmd{
Name: "status",
Desc: "prints some debug status informations",
Fn: func(env Env, args []string) error {
config, err := LoadConfig(env)
if err != nil {
return err
}
fmt.Println("direnv exec path", config.SelfPath)
fmt.Println("DIRENV_CONFIG", config.ConfDir)
loadedRC := config.LoadedRC()
foundRC := config.FindRC()
if loadedRC != nil {
fmt.Println("Loaded RC path", loadedRC.path)
fmt.Println("Loaded RC mtime", loadedRC.mtime)
fmt.Println("Loaded RC allowed", loadedRC.Allowed())
fmt.Println("Loaded RC allowPath", loadedRC.allowPath)
} else {
fmt.Println("No .envrc loaded")
}
if foundRC != nil {
fmt.Println("Found RC path", foundRC.path)
fmt.Println("Found RC mtime", foundRC.mtime)
fmt.Println("Found RC allowed", foundRC.Allowed())
fmt.Println("Found RC allowPath", foundRC.allowPath)
} else {
fmt.Println("No .envrc found")
}
return nil
},
}