remember instance choice for prompt

master
Clyne 1 year ago
parent 4822a5f4c0
commit 9ad3988802
Signed by: clyne
GPG Key ID: 1B74EE6C49C96795

@ -102,10 +102,10 @@
(flush) (flush)
(read-line)) (read-line))
(defn show-instance-prompt [] (defn show-instance-prompt [current]
(printf "Enter instance name [%s]: " DEFAULT-INSTANCE) (printf "Enter instance name [%s]: " current)
(flush) (flush)
(let [inst (read-line)] (if (empty? inst) DEFAULT-INSTANCE inst))) (let [inst (read-line)] (if (empty? inst) current inst)))
(defn view-post (defn view-post
"Main loop for viewing a post and its comments." "Main loop for viewing a post and its comments."
@ -158,7 +158,7 @@
"Updates state for viewing a different instance." "Updates state for viewing a different instance."
[state] [state]
(-> state (-> state
(assoc :instance (show-instance-prompt)) (assoc :instance (show-instance-prompt (:instance state)))
(change-community))) (change-community)))
(defn view-page (defn view-page
@ -191,7 +191,7 @@
(defn -main [& args] (defn -main [& args]
(println "Welcome to lemmold, your old-school Lemmy browser!") (println "Welcome to lemmold, your old-school Lemmy browser!")
(println) (println)
(let [instance (show-instance-prompt) (let [instance (show-instance-prompt DEFAULT-INSTANCE)
community (show-community-prompt)] community (show-community-prompt)]
(view-page instance community)) (view-page instance community))
(println "Goodbye.") (println "Goodbye.")

Loading…
Cancel
Save