summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2019-09-28 18:05:56 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2019-09-28 18:05:56 +0200
commitb222cd40d4a0bfe081dafee91db1aa2154f47649 (patch)
treee1d44d676958555976d010db7600b1750ee9b197
parentf121ff66365ad1409f9903bbfaca1c0c90c71b68 (diff)
UI: continue input line when ending with backslash
-rw-r--r--src/Main.hs8
1 files changed, 7 insertions, 1 deletions
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 "<unnamed>" 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