Files
sgard/cmd/sgard/status.go
Kyle Isom 661c050d83 Step 5: Checkpoint and Status.
Checkpoint re-hashes all tracked files, stores changed blobs, and
updates per-file timestamps only when content changes. Missing files
are skipped gracefully. Status compares each tracked entry against
the filesystem and reports ok/modified/missing.

CLI: sgard checkpoint [-m message], sgard status.
4 new tests (changed file, unchanged file, missing file, status).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 21:36:55 -07:00

35 lines
550 B
Go

package main
import (
"fmt"
"github.com/kisom/sgard/garden"
"github.com/spf13/cobra"
)
var statusCmd = &cobra.Command{
Use: "status",
Short: "Show status of tracked files: ok, modified, or missing",
RunE: func(cmd *cobra.Command, args []string) error {
g, err := garden.Open(repoFlag)
if err != nil {
return err
}
statuses, err := g.Status()
if err != nil {
return err
}
for _, s := range statuses {
fmt.Printf("%-10s %s\n", s.State, s.Path)
}
return nil
},
}
func init() {
rootCmd.AddCommand(statusCmd)
}