MCPcopy
hub / github.com/direnv/direnv / Allow

Method Allow

internal/cmd/rc.go:100–120  ·  view source on GitHub ↗

Allow grants the RC as allowed to load

()

Source from the content-addressed store, hash-verified

98
99// Allow grants the RC as allowed to load
100func (rc *RC) Allow() (err error) {
101 if rc.allowPath == "" {
102 return fmt.Errorf("cannot allow empty path")
103 }
104 if err = os.MkdirAll(filepath.Dir(rc.allowPath), 0755); err != nil {
105 return
106 }
107 if err = allow(rc.path, rc.allowPath); err != nil {
108 return
109 }
110 if err = rc.times.Update(rc.allowPath); err != nil {
111 return
112 }
113 if _, err = os.Stat(rc.denyPath); err != nil {
114 if errors.Is(err, fs.ErrNotExist) {
115 return nil
116 }
117 return err
118 }
119 return os.Remove(rc.denyPath)
120}
121
122// Deny revokes the permission of the RC file to load
123func (rc *RC) Deny() (err error) {

Callers 2

cmdEditActionFunction · 0.95
cmdAllowActionFunction · 0.80

Calls 3

allowFunction · 0.85
UpdateMethod · 0.80
RemoveMethod · 0.80

Tested by

no test coverage detected