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:
31
cmd/sgard/remove.go
Normal file
31
cmd/sgard/remove.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user