Step 7: Add remove command to stop tracking files.

Implements Garden.Remove() which unregisters paths from the manifest,
plus unit tests and the CLI wiring via cobra.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 21:49:57 -07:00
parent 0d53ca34aa
commit 4da1574949
3 changed files with 134 additions and 0 deletions

31
cmd/sgard/remove.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
"fmt"
"github.com/kisom/sgard/garden"
"github.com/spf13/cobra"
)
var removeCmd = &cobra.Command{
Use: "remove <path>...",
Short: "Stop tracking files",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
g, err := garden.Open(repoFlag)
if err != nil {
return err
}
if err := g.Remove(args); err != nil {
return err
}
fmt.Printf("Removed %d path(s)\n", len(args))
return nil
},
}
func init() {
rootCmd.AddCommand(removeCmd)
}