parseSettings looks for `$HOME/.fac.yml` and parses it into a `Binding` value If the file does not exist, it returns the `defaultBinding`
()
| 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` |
| 100 | func 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 |
no outgoing calls