From 6c2e0d5ce28e4ed1ff35d7795b80988142190524 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 17 Oct 2014 15:50:03 +0000 Subject: [PATCH] ps -lines preserves line-by-line structure when preprocessing files for parsing line by line --- src/compiler/GF/Command/Commands.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index e1a5a3438..e67de95cf 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -698,8 +698,14 @@ allCommands = Map.fromList [ exec = \_ opts x -> do let (os,fs) = optsAndFlags opts trans <- optTranslit opts - return ((fromString . trans . stringOps (envFlag fs) (map prOpt os) . toString) x), - options = stringOpOptions, + + if isOpt "lines" opts + then return $ fromStrings $ map (trans . stringOps (envFlag fs) (map prOpt os)) $ toStrings x + else return ((fromString . trans . stringOps (envFlag fs) (map prOpt os) . toString) x), + options = [ + ("lines","apply the operation separately to each input line, returning a list of lines") + ] ++ + stringOpOptions, flags = [ ("env","apply in this environment only"), ("from","backward-apply transliteration defined in this file (format 'unicode translit' per line)"),