(deps commandDeps, workspaceRef string, cwd string)
| 1305 | } |
| 1306 | |
| 1307 | func resolveSessionCreateWorkspace(deps commandDeps, workspaceRef string, cwd string) (string, string, error) { |
| 1308 | trimmedWorkspace := strings.TrimSpace(workspaceRef) |
| 1309 | trimmedCWD := strings.TrimSpace(cwd) |
| 1310 | |
| 1311 | switch { |
| 1312 | case trimmedWorkspace != "" && trimmedCWD != "": |
| 1313 | return "", "", errors.New("cli: --workspace and --cwd are mutually exclusive") |
| 1314 | case trimmedWorkspace != "": |
| 1315 | return trimmedWorkspace, "", nil |
| 1316 | case trimmedCWD != "": |
| 1317 | if !filepath.IsAbs(trimmedCWD) { |
| 1318 | return "", "", fmt.Errorf("cli: --cwd must be an absolute path: %q", trimmedCWD) |
| 1319 | } |
| 1320 | return "", filepath.Clean(trimmedCWD), nil |
| 1321 | default: |
| 1322 | workspacePath, err := currentWorkingDirectory(deps) |
| 1323 | if err != nil { |
| 1324 | return "", "", err |
| 1325 | } |
| 1326 | return "", workspacePath, nil |
| 1327 | } |
| 1328 | } |
| 1329 | |
| 1330 | func flattenHistory(history []TurnHistoryRecord) []SessionEventRecord { |
| 1331 | flattened := make([]SessionEventRecord, 0) |
no test coverage detected