GetAll loads all values from ~/.rill/{filename}. It assumes filename identifies a YAML file.
(filename string)
| 54 | // GetAll loads all values from ~/.rill/{filename}. |
| 55 | // It assumes filename identifies a YAML file. |
| 56 | func (d DotRill) GetAll(filename string) (map[string]string, error) { |
| 57 | filename, err := d.ResolveFilename(filename, false) |
| 58 | if err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | |
| 62 | data, err := os.ReadFile(filename) |
| 63 | if err != nil { |
| 64 | if os.IsNotExist(err) { |
| 65 | return map[string]string{}, nil |
| 66 | } |
| 67 | return nil, err |
| 68 | } |
| 69 | |
| 70 | conf := map[string]string{} |
| 71 | err = yaml.Unmarshal(data, &conf) |
| 72 | if err != nil { |
| 73 | return nil, err |
| 74 | } |
| 75 | |
| 76 | return conf, nil |
| 77 | } |
| 78 | |
| 79 | // Get returns a single entry from ~/.rill/{filename}. |
| 80 | // It assumes filename identifies a YAML file. |
no test coverage detected