From 04b62e6d3b252a689e7e50fcc234463afa8a6d2b Mon Sep 17 00:00:00 2001 From: vikingowl Date: Fri, 3 Apr 2026 11:17:38 +0200 Subject: [PATCH] feat: project scaffold with cobra root and domain types --- cmd/root.go | 20 +++++++++++++++++ go.mod | 9 ++++++++ go.sum | 10 +++++++++ internal/domain/domain.go | 46 +++++++++++++++++++++++++++++++++++++++ main.go | 7 ++++++ 5 files changed, 92 insertions(+) create mode 100644 cmd/root.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 internal/domain/domain.go create mode 100644 main.go diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..dccb399 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,20 @@ +package cmd + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "reddit-reader", + Short: "Monitor subreddits for interesting posts", +} + +func Execute() { + if err := rootCmd.Execute(); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..693f131 --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module somegit.dev/vikingowl/reddit-reader + +go 1.26 + +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/go.sum b/go.sum new file mode 100644 index 0000000..a6ee3e0 --- /dev/null +++ b/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/internal/domain/domain.go b/internal/domain/domain.go new file mode 100644 index 0000000..4bdc40a --- /dev/null +++ b/internal/domain/domain.go @@ -0,0 +1,46 @@ +package domain + +import "time" + +type Post struct { + ID string + Subreddit string + Title string + Author string + URL string + SelfText string + Score int + CreatedUTC time.Time + FetchedAt time.Time + Relevance *float64 + Summary *string + Read bool + Starred bool + Dismissed bool +} + +type Subreddit struct { + Name string + Enabled bool + PollSort string + AddedAt time.Time +} + +type Filter struct { + ID int64 + Subreddit string + Pattern string + IsRegex bool +} + +type Feedback struct { + ID int64 + PostID string + Vote int // +1 interesting, -1 not + CreatedAt time.Time +} + +type Interests struct { + Description string + Examples []Feedback +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..4936a0f --- /dev/null +++ b/main.go @@ -0,0 +1,7 @@ +package main + +import "somegit.dev/vikingowl/reddit-reader/cmd" + +func main() { + cmd.Execute() +}