MCPcopy
hub / github.com/mkchoi212/fac / parseSettings

Function parseSettings

binding/binding.go:100–120  ·  view source on GitHub ↗

parseSettings looks for `$HOME/.fac.yml` and parses it into a `Binding` value If the file does not exist, it returns the `defaultBinding`

()

Source from the content-addressed store, hash-verified

98// parseSettings looks for `$HOME/.fac.yml` and parses it into a `Binding` value
99// If the file does not exist, it returns the `defaultBinding`
100func parseSettings() (Binding, error) {
101 userBinding := make(Binding)
102
103 usr, err := currentUser()
104 if err != nil {
105 return defaultBinding, err
106 }
107
108 // Read config file
109 f, err := ioutil.ReadFile(usr.HomeDir + "/.fac.yml")
110 if err != nil {
111 return defaultBinding, err
112 }
113
114 // Parse config file
115 if err = yaml.Unmarshal(f, &userBinding); err != nil {
116 return defaultBinding, err
117 }
118
119 return userBinding, nil
120}
121
122// consolidate takes the user's key-binding settings and fills the missings key-binds
123// with the default key-binding values

Callers 2

LoadSettingsFunction · 0.85
TestParseSettingsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseSettingsFunction · 0.68