From b222cd40d4a0bfe081dafee91db1aa2154f47649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 28 Sep 2019 18:05:56 +0200 Subject: UI: continue input line when ending with backslash --- src/Main.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index b42c3cf..6b06811 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -119,11 +119,17 @@ main = runInputT defaultSettings $ do | otherwise -> extPrint $ "Owner mismatch" | otherwise -> extPrint $ "Unknown service: " ++ T.unpack svc + let getInputLines prompt = do + Just input <- lift $ getInputLine prompt + case reverse input of + '\\':rest -> (reverse ('\n':rest) ++) <$> getInputLines ">> " + _ -> return input + let process cstate = do let pname = case csPeer cstate of Nothing -> "" Just peer -> maybe "" T.unpack $ idName . fromStored . signedData . fromStored . finalOwner <=< peerIdentity $ peer - Just input <- lift $ getInputLine $ pname ++ "> " + input <- getInputLines $ pname ++ "> " let (cmd, line) = case input of '/':rest -> let (scmd, args) = dropWhile isSpace <$> span isAlphaNum rest in if all isDigit scmd -- cgit v1.2.3