diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c3c300 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Go +bin/ +*.exe +*.exe~ +*.dll +*.so +*.dylib +*.test +*.out +vendor/ + +# CSV imports (temporary) +data/ + +# Local notes and planning +notes/ diff --git a/cli/LICENSE b/cli/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/cli/README.md b/cli/README.md new file mode 100644 index 0000000..29eb820 --- /dev/null +++ b/cli/README.md @@ -0,0 +1,8 @@ +# Book import CLI + +A StoryGraph (and by extension Goodreads) importer into the canonical atproto book lexicons. + +Usage: +``` +import storygraph [filename.csv] +``` diff --git a/cli/cmd/root.go b/cli/cmd/root.go new file mode 100644 index 0000000..14ec43b --- /dev/null +++ b/cli/cmd/root.go @@ -0,0 +1,25 @@ +/* +Copyright © 2026 Hector Alfaro +*/ +package cmd + +import ( + "os" + + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "importer", + Short: "Import book data into atproto lexicon records", +} + +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +func init() { +} diff --git a/cli/cmd/storygraph.go b/cli/cmd/storygraph.go new file mode 100644 index 0000000..d12f728 --- /dev/null +++ b/cli/cmd/storygraph.go @@ -0,0 +1,33 @@ +/* +Copyright © 2026 Hector Alfaro +*/ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +// importCmd represents the import command +var importCmd = &cobra.Command{ + Use: "storygraph", + Short: "Import from a StoryGraph CSV", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("storygraph import called") + }, +} + +func init() { + rootCmd.AddCommand(importCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // importCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // importCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/cli/go.mod b/cli/go.mod new file mode 100644 index 0000000..cdb3ddc --- /dev/null +++ b/cli/go.mod @@ -0,0 +1,9 @@ +module tangled.org/hectorsector.com/books/cli + +go 1.26.2 + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/cobra v1.10.2 // indirect + github.com/spf13/pflag v1.0.9 // indirect +) diff --git a/cli/go.sum b/cli/go.sum new file mode 100644 index 0000000..a6ee3e0 --- /dev/null +++ b/cli/go.sum @@ -0,0 +1,10 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/cli/internal/storygraph/parse.go b/cli/internal/storygraph/parse.go new file mode 100644 index 0000000..bb814e3 --- /dev/null +++ b/cli/internal/storygraph/parse.go @@ -0,0 +1,11 @@ +package storygraph + +import "time" + +type Book struct { + Title string + ISBN string + ReadStatus string + DateAdded time.Time + LastDateRead time.Time +} diff --git a/cli/main.go b/cli/main.go new file mode 100644 index 0000000..c92209f --- /dev/null +++ b/cli/main.go @@ -0,0 +1,10 @@ +/* +Copyright © 2026 Hector Alfaro +*/ +package main + +import "tangled.org/hectorsector.com/books/cli/cmd" + +func main() { + cmd.Execute() +}