Remove: untrack files, remove manifest entries, save. 2 tests. Verify: check blobs against manifest hashes, report ok/mismatch/missing. 3 tests. List: return all tracked entries, CLI formats by type. 2 tests. Diff: compare stored blob vs current file, simple line diff. 3 tests. Each command in its own file (garden/<cmd>.go) for parallel development. Remove, verify, list implemented by parallel worktree agents; diff manual. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38 lines
567 B
Go
38 lines
567 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/kisom/sgard/garden"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var diffCmd = &cobra.Command{
|
|
Use: "diff <path>",
|
|
Short: "Show differences between stored and current file",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
g, err := garden.Open(repoFlag)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
d, err := g.Diff(args[0])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if d == "" {
|
|
fmt.Println("No changes.")
|
|
} else {
|
|
fmt.Print(d)
|
|
}
|
|
|
|
return nil
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(diffCmd)
|
|
}
|