resolveProjectTaskDir loads the project's .taskmd.yaml and returns the task directory.
(projectPath string)
| 297 | |
| 298 | // resolveProjectTaskDir loads the project's .taskmd.yaml and returns the task directory. |
| 299 | func resolveProjectTaskDir(projectPath string) (string, error) { |
| 300 | projectConfig := filepath.Join(projectPath, ".taskmd.yaml") |
| 301 | if _, err := os.Stat(projectConfig); err == nil { |
| 302 | viper.SetConfigFile(projectConfig) |
| 303 | if err := viper.ReadInConfig(); err != nil { |
| 304 | return "", fmt.Errorf("read project config: %w", err) |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | if viper.InConfig("task-dir") { |
| 309 | return resolveRelativeToConfig(viper.GetString("task-dir")), nil |
| 310 | } |
| 311 | if viper.InConfig("dir") { |
| 312 | return resolveRelativeToConfig(viper.GetString("dir")), nil |
| 313 | } |
| 314 | |
| 315 | return projectPath, nil |
| 316 | } |
| 317 | |
| 318 | // resolveDefaultProject checks the global config for a default_project setting |
| 319 | // and resolves it to a task directory. Returns empty string if not set or invalid. |
no test coverage detected