package cmd import ( "fmt" "github.com/spf13/cobra" "github.com/warrenronsiek/ctask/internal/config" ) var pathCmd = &cobra.Command{ Use: "path ", Short: "Print the absolute filesystem path of a workspace", Args: cobra.ExactArgs(1), SilenceUsage: true, RunE: runPath, } func init() { pathCmd.ValidArgsFunction = completeWorkspaces(completionAny) rootCmd.AddCommand(pathCmd) } // runPath prints QueryResult.Path to stdout with a single trailing newline. // Uses native path separators — backslashes on Windows, forward slashes on // Linux. Output is meant to be consumed by shell pipelines and agent tooling. func runPath(cmd *cobra.Command, args []string) error { roots := config.SearchRoots() ws := resolveOne(roots, args[0], true) fmt.Println(ws.Path) return nil }