summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-03-22 20:27:18 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-03-22 20:27:18 +0100
commitd9436e29a827822d0fe5c093283c57955cebe386 (patch)
tree0fdaec281ba8751c9b7c05207a6333046f6c249c /main
parentd7666d78cea8500b18ef399cd0fd640551e9dde0 (diff)
Replace remaining getLine usage with getInputLine
Diffstat (limited to 'main')
-rw-r--r--main/Main.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/main/Main.hs b/main/Main.hs
index 93ecbb5..0430b53 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -771,12 +771,12 @@ cmdChatrooms = do
cmdChatroomCreatePublic :: Command
cmdChatroomCreatePublic = do
+ term <- asks ciTerminal
name <- asks ciLine >>= \case
line | not (null line) -> return $ T.pack line
_ -> liftIO $ do
- T.putStr $ T.pack "Name: "
- hFlush stdout
- T.getLine
+ setPrompt term "Name: "
+ getInputLine term $ KeepPrompt . maybe T.empty T.pack
ensureWatchedChatrooms
void $ createChatroom
@@ -964,11 +964,15 @@ cmdIceConnect :: Command
cmdIceConnect = do
s:_ <- gets csIceSessions
server <- asks ciServer
- let loadInfo = BC.getLine >>= \case line | BC.null line -> return []
- | otherwise -> (line:) <$> loadInfo
+ term <- asks ciTerminal
+ let loadInfo =
+ getInputLine term (KeepPrompt . maybe BC.empty BC.pack) >>= \case
+ line | BC.null line -> return []
+ | otherwise -> (line :) <$> loadInfo
Right remote <- liftIO $ do
st <- memoryStorage
pst <- derivePartialStorage st
+ setPrompt term ""
rbytes <- (BL.fromStrict . BC.unlines) <$> loadInfo
copyRef st =<< storeRawBytes pst (BL.fromChunks [ BC.pack "rec ", BC.pack (show (BL.length rbytes)), BC.singleton '\n' ] `BL.append` rbytes)
liftIO $ iceConnect s (load remote) $ void $ serverPeerIce server s