summaryrefslogtreecommitdiff
path: root/shelf/cmd/sum/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'shelf/cmd/sum/main.go')
-rw-r--r--shelf/cmd/sum/main.go32
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)
+ }
+}