raven.go: add arg length check to twt command

This commit is contained in:
Iris Lightshard 2023-01-09 22:48:07 -07:00
parent 057771467d
commit c274e63e82
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
4 changed files with 20 additions and 15 deletions

View file

@ -28,7 +28,12 @@ func run(args []string) error {
} else { } else {
switch args[1] { switch args[1] {
case "twt": case "twt":
if len(args) > 2 {
return Post(args[2], cfg.FeedFile, cfg.FeedAscend) return Post(args[2], cfg.FeedFile, cfg.FeedAscend)
} else {
helpMe(args[0])
return errors.New("ARG is required with the twt command")
}
case "feed": case "feed":
if len(args) > 2 { if len(args) > 2 {
return GetFeed(args[2], cfg.FriendsFile, cfg.MaxPosts) return GetFeed(args[2], cfg.FriendsFile, cfg.MaxPosts)