diff --git a/config.go b/config.go index b40763a..b345465 100644 --- a/config.go +++ b/config.go @@ -1,4 +1,4 @@ -package main +package main import ( "fmt" @@ -138,7 +138,7 @@ func parseConfig(configFile string) *Config { f, err := os.ReadFile(configFile) cfg := &Config{} if err != nil { - fmt.Println(err.Error()) + fmt.Println(err.Error()) return cfg } @@ -173,4 +173,4 @@ func parseConfig(configFile string) *Config { } } return cfg -} \ No newline at end of file +} diff --git a/feed.go b/feed.go index be23540..a0a0501 100644 --- a/feed.go +++ b/feed.go @@ -80,13 +80,13 @@ func buildFeed(feed *Feed, nick, data string, max int64) error { lines := strings.Split(data, "\n") for i, l := range lines { - if int64(i) > max { - return nil - } + if int64(i) > max { + return nil + } parts := strings.Split(l, "\t") t, err := time.Parse(time.RFC3339, parts[0]) if err != nil { - continue + continue } *feed = append(*feed, FeedEntry{ Nick: nick, @@ -134,7 +134,7 @@ func GetFeed(friend, friendsFile string, max int64) error { return err } if len(friend) > 0 { - break + break } } } @@ -150,4 +150,4 @@ func GetOwnFeed(nick, feedFile string, max int64) error { } printFeed(feed) return nil -} \ No newline at end of file +} diff --git a/raven.go b/raven.go index 86b7dce..e1f7166 100644 --- a/raven.go +++ b/raven.go @@ -28,7 +28,12 @@ func run(args []string) error { } else { switch args[1] { case "twt": - return Post(args[2], cfg.FeedFile, cfg.FeedAscend) + if len(args) > 2 { + return Post(args[2], cfg.FeedFile, cfg.FeedAscend) + } else { + helpMe(args[0]) + return errors.New("ARG is required with the twt command") + } case "feed": if len(args) > 2 { return GetFeed(args[2], cfg.FriendsFile, cfg.MaxPosts) diff --git a/types.go b/types.go index 9b2d9df..1ef8bfd 100644 --- a/types.go +++ b/types.go @@ -5,11 +5,11 @@ import ( ) type Config struct { - FeedFile string - FeedAscend bool - FriendsFile string - MaxPosts int64 - Nick string + FeedFile string + FeedAscend bool + FriendsFile string + MaxPosts int64 + Nick string } type FeedEntry struct {