|
|
@ -22,7 +22,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
(defn comments-list [post]
|
|
|
|
(defn comments-list [post]
|
|
|
|
(-> (make-api-url INSTANCE COMMENTS)
|
|
|
|
(-> (make-api-url INSTANCE COMMENTS)
|
|
|
|
(api-call {:id (get-in post ["post" "id"])})
|
|
|
|
(api-call {:post_id (str (get-in post ["post" "id"]))})
|
|
|
|
(get "comments")))
|
|
|
|
(get "comments")))
|
|
|
|
|
|
|
|
|
|
|
|
(defn show-post-item [post]
|
|
|
|
(defn show-post-item [post]
|
|
|
@ -34,7 +34,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
(defn show-comment-item [commnt]
|
|
|
|
(defn show-comment-item [commnt]
|
|
|
|
(println (get-in commnt ["creator" "name"]) "says:")
|
|
|
|
(println (get-in commnt ["creator" "name"]) "says:")
|
|
|
|
(println (get-in commnt ["comment" "content"]))
|
|
|
|
|
|
|
|
(println)
|
|
|
|
(println)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -52,20 +51,20 @@
|
|
|
|
(first (read-line)))
|
|
|
|
(first (read-line)))
|
|
|
|
|
|
|
|
|
|
|
|
(defn show-comments-prompt []
|
|
|
|
(defn show-comments-prompt []
|
|
|
|
(print "BNPQ> ")
|
|
|
|
(print "BNP> ")
|
|
|
|
(flush)
|
|
|
|
(flush)
|
|
|
|
(first (read-line)))
|
|
|
|
(first (read-line)))
|
|
|
|
|
|
|
|
|
|
|
|
(defn view-post [post]
|
|
|
|
(defn view-post [post]
|
|
|
|
(println "Viewing post id:" (get-in post ["post" "id"]))
|
|
|
|
(println "Viewing post id:" (get-in post ["post" "id"]))
|
|
|
|
(loop [offset 0 comments (comments-list (get-in post ["post" "id"]))]
|
|
|
|
(loop [offset 0 comments (comments-list post)]
|
|
|
|
|
|
|
|
(println (count comments) offset)
|
|
|
|
(show-comments (if (pos? offset) (drop (* 5 offset) comments) comments))
|
|
|
|
(show-comments (if (pos? offset) (drop (* 5 offset) comments) comments))
|
|
|
|
(flush)
|
|
|
|
(flush)
|
|
|
|
(case (show-comments-prompt)
|
|
|
|
(case (show-comments-prompt)
|
|
|
|
\B (println)
|
|
|
|
\B (println)
|
|
|
|
\N (recur (inc offset) comments)
|
|
|
|
\N (recur (inc offset) comments)
|
|
|
|
\P (recur (dec offset) comments)
|
|
|
|
\P (recur (dec offset) comments)
|
|
|
|
\Q (println "Goodbye.")
|
|
|
|
|
|
|
|
(do (println "Unknown command.") (recur offset comments)))))
|
|
|
|
(do (println "Unknown command.") (recur offset comments)))))
|
|
|
|
|
|
|
|
|
|
|
|
(defn -main [& args]
|
|
|
|
(defn -main [& args]
|
|
|
|