diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-23 18:14:50 +0200 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-23 20:21:12 +0200 |
| commit | 875ac19922932b12f6357d64a460c06d031000e7 (patch) | |
| tree | f4f268ef2b029a5e187613d6ebbec1a166615dbc /shelf/cmd/sum/main.go | |
| parent | d35f5fad1d26fc09cfd98f6e7faf17d6a48e4e8f (diff) | |
Add shelf module
Diffstat (limited to 'shelf/cmd/sum/main.go')
| -rw-r--r-- | shelf/cmd/sum/main.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/shelf/cmd/sum/main.go b/shelf/cmd/sum/main.go new file mode 100644 index 0000000..441a706 --- /dev/null +++ b/shelf/cmd/sum/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "flag" + "log" + "os" + + "go.jknobloc.com/x/shelf" +) + +func main() { + rootPath := flag.String("root", ".shelf", "Path to the shelf") + ignorePath := flag.String("ignore", ".shelfignore", "Path to .shelfignore") + + flag.Parse() + + shelf.Root = *rootPath + + ignore, _ := os.ReadFile(*ignorePath) + + var sum shelf.Sum + + if s, err := shelf.Index(ignore); err != nil { + log.Fatal(err) + } else { + sum = s + } + + if err := shelf.Serialize(sum, os.Stdout); err != nil { + log.Fatal(err) + } +} |
