resolveProjectEntry normalizes a single YAML project entry into a GlobalProjectEntry.
(p globalProjectYAML, index int, cfgDir string)
| 111 | |
| 112 | // resolveProjectEntry normalizes a single YAML project entry into a GlobalProjectEntry. |
| 113 | func resolveProjectEntry(p globalProjectYAML, index int, cfgDir string) (GlobalProjectEntry, error) { |
| 114 | if p.Path == "" { |
| 115 | return GlobalProjectEntry{}, fmt.Errorf("projects[%d]: path is required", index) |
| 116 | } |
| 117 | |
| 118 | resolved, err := resolvePath(p.Path, cfgDir) |
| 119 | if err != nil { |
| 120 | return GlobalProjectEntry{}, fmt.Errorf("projects[%d]: %w", index, err) |
| 121 | } |
| 122 | |
| 123 | id := p.ID |
| 124 | if id == "" { |
| 125 | id = filepath.Base(resolved) |
| 126 | } |
| 127 | |
| 128 | name := p.Name |
| 129 | if name == "" { |
| 130 | name = id |
| 131 | } |
| 132 | |
| 133 | return GlobalProjectEntry{ID: id, Name: name, Path: resolved}, nil |
| 134 | } |
| 135 | |
| 136 | // globalConfigPath returns the path to the global config file. |
| 137 | // Checks $TASKMD_HOME_CONFIG first, then falls back to ~/.taskmd.yaml. |
no test coverage detected