@@ -2,7 +2,9 @@ package setup
22
33import (
44 "fmt"
5+ "sort"
56 "strconv"
7+ "strings"
68
79 "github.com/safedep/pmg/config"
810 "github.com/safedep/pmg/internal/alias"
@@ -90,5 +92,37 @@ func executeSetupInfo() error {
9092
9193 ui .PrintInfoSection ("Security" , securityEntries )
9294
95+ // Sandbox section
96+ sandboxCfg := cfg .Config .Sandbox
97+ sandboxEntries := make (map [string ]string )
98+ sandboxEntries ["Enabled" ] = strconv .FormatBool (sandboxCfg .Enabled )
99+ sandboxEntries ["Enforce Always" ] = strconv .FormatBool (sandboxCfg .EnforceAlways )
100+
101+ if len (sandboxCfg .Policies ) > 0 {
102+ pmNames := make ([]string , 0 , len (sandboxCfg .Policies ))
103+ for name := range sandboxCfg .Policies {
104+ pmNames = append (pmNames , name )
105+ }
106+
107+ sort .Strings (pmNames )
108+
109+ policyParts := make ([]string , 0 , len (pmNames ))
110+ for _ , name := range pmNames {
111+ ref := sandboxCfg .Policies [name ]
112+ status := "disabled"
113+ if ref .Enabled {
114+ status = ref .Profile
115+ }
116+
117+ policyParts = append (policyParts , fmt .Sprintf ("%s(%s)" , name , status ))
118+ }
119+
120+ sandboxEntries ["Policies" ] = strings .Join (policyParts , ", " )
121+ } else {
122+ sandboxEntries ["Policies" ] = "None"
123+ }
124+
125+ ui .PrintInfoSection ("Sandbox" , sandboxEntries )
126+
93127 return nil
94128}
0 commit comments