Files
sgard/cmd/sgard/remove.go
Kyle Isom 4da1574949 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>
2026-03-23 21:49:57 -07:00

32 lines
516 B
Go

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)
}