|
|
@ -120,12 +120,27 @@
|
|
|
|
\P (recur (dec offset) comments)
|
|
|
|
\P (recur (dec offset) comments)
|
|
|
|
(do (println "Unknown command.") (recur offset comments)))))
|
|
|
|
(do (println "Unknown command.") (recur offset comments)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn view-post-body
|
|
|
|
|
|
|
|
"Shows the body of the post if available; in that case, ask about viewing comments."
|
|
|
|
|
|
|
|
[post]
|
|
|
|
|
|
|
|
(let [body (get-in post ["post" "body"])]
|
|
|
|
|
|
|
|
(or (empty? body)
|
|
|
|
|
|
|
|
(do
|
|
|
|
|
|
|
|
(println)
|
|
|
|
|
|
|
|
(println "Post contents:")
|
|
|
|
|
|
|
|
(println)
|
|
|
|
|
|
|
|
(println body)
|
|
|
|
|
|
|
|
(println)
|
|
|
|
|
|
|
|
(print "BC> ")
|
|
|
|
|
|
|
|
(flush)
|
|
|
|
|
|
|
|
(= \C (first (read-line)))))))
|
|
|
|
|
|
|
|
|
|
|
|
(defn view-nth-post
|
|
|
|
(defn view-nth-post
|
|
|
|
"Views the index-th post from the current post list."
|
|
|
|
"Views the index-th post from the current post list."
|
|
|
|
[state posts index]
|
|
|
|
[state posts index]
|
|
|
|
(view-post
|
|
|
|
(let [post (nth posts (cond-> (+ 5 index) (:top state) (- 5)))]
|
|
|
|
(:instance state)
|
|
|
|
(when (view-post-body post)
|
|
|
|
(nth posts (cond-> (+ 5 index) (:top state) (- 5))))
|
|
|
|
(view-post (:instance state) post)))
|
|
|
|
state)
|
|
|
|
state)
|
|
|
|
|
|
|
|
|
|
|
|
(defn get-post-list
|
|
|
|
(defn get-post-list
|
|
|
|