feat(v0.5): show launch_dir fields in ctask info output

For project workspaces with launch_dir set, info prints three extra
lines after Path: Launch dir, Launch path, and Dir exists (yes/no
from a direct os.Stat of the intended path). Tasks and pre-v0.5
projects still omit these lines.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 19:50:07 -04:00
parent 103f2cd33e
commit cdff7f32eb
2 changed files with 129 additions and 0 deletions
+17
View File
@@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"os"
"path/filepath"
"github.com/spf13/cobra"
"github.com/warrenronsiek/ctask/internal/config"
@@ -38,6 +39,22 @@ func runInfo(cmd *cobra.Command, args []string) error {
fmt.Printf("Updated: %s\n", m.UpdatedAt.Format("2006-01-02 15:04:05"))
fmt.Printf("Path: %s\n", ws.Path)
if m.LaunchDir != "" {
// Per spec amendment: stat the expected path directly instead of
// inferring existence from ResolveLaunch's fallback behavior. info
// is a display command, not a launch command — a permission error
// here is the same user-facing outcome as "not a directory", so
// we just report whether the stat succeeded with a directory.
launchAbs := filepath.Join(ws.Path, m.LaunchDir)
dirExists := "no"
if info, err := os.Stat(launchAbs); err == nil && info.IsDir() {
dirExists = "yes"
}
fmt.Printf("Launch dir: %s/\n", m.LaunchDir)
fmt.Printf("Launch path: %s\n", launchAbs)
fmt.Printf("Dir exists: %s\n", dirExists)
}
if m.ArchivedAt != nil {
fmt.Printf("Archived: %s\n", m.ArchivedAt.Format("2006-01-02 15:04:05"))
}