From d53e1713c7860de8a5c256ffe0eed81d5388ae41 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Fri, 2 Jul 2021 16:08:34 +0800 Subject: resolves GrammaticalFramework/gf-core/#97 --- src/compiler/GF/Command/CommonCommands.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/compiler/GF/Command') diff --git a/src/compiler/GF/Command/CommonCommands.hs b/src/compiler/GF/Command/CommonCommands.hs index 0b698e79c..578331e65 100644 --- a/src/compiler/GF/Command/CommonCommands.hs +++ b/src/compiler/GF/Command/CommonCommands.hs @@ -170,10 +170,13 @@ commonCommands = fmap (mapCommandExec liftSIO) $ Map.fromList [ restrictedSystem $ syst ++ " <" ++ tmpi ++ " >" ++ tmpo fmap fromString $ restricted $ readFile tmpo, -} - fmap fromString . restricted . readShellProcess syst $ toString arg, + fmap (fromStrings . lines) . restricted . readShellProcess syst . unlines $ toStrings arg, flags = [ ("command","the system command applied to the argument") ], + options = [ + ("lines","preserve input lines, and return output as a list of lines") + ], examples = [ mkEx "gt | l | ? wc -- generate trees, linearize, and count words" ] -- cgit v1.2.3 From dff215504a71235d0aeb6852e64ef682cc095668 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Tue, 6 Jul 2021 15:00:17 +0800 Subject: resolves GrammaticalFramework/gf-core/#97, without l --- src/compiler/GF/Command/CommonCommands.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/compiler/GF/Command') diff --git a/src/compiler/GF/Command/CommonCommands.hs b/src/compiler/GF/Command/CommonCommands.hs index 578331e65..7ca2c0ee4 100644 --- a/src/compiler/GF/Command/CommonCommands.hs +++ b/src/compiler/GF/Command/CommonCommands.hs @@ -15,6 +15,7 @@ import GF.Command.Abstract --(isOpt,valStrOpts,prOpt) import GF.Text.Pretty import GF.Text.Transliterations import GF.Text.Lexing(stringOp,opInEnv) +import Data.Char (isSpace) import qualified PGF as H(showCId,showExpr,toATree,toTrie,Trie(..)) @@ -170,7 +171,8 @@ commonCommands = fmap (mapCommandExec liftSIO) $ Map.fromList [ restrictedSystem $ syst ++ " <" ++ tmpi ++ " >" ++ tmpo fmap fromString $ restricted $ readFile tmpo, -} - fmap (fromStrings . lines) . restricted . readShellProcess syst . unlines $ toStrings arg, + fmap (fromStrings . lines) . restricted . readShellProcess syst . unlines . map (dropWhile (=='\n')) $ toStrings $ arg, + flags = [ ("command","the system command applied to the argument") ], -- cgit v1.2.3 From 1e3de38ac4e9d4eee8bb947fb16682490a1130c5 Mon Sep 17 00:00:00 2001 From: Meowyam Date: Tue, 6 Jul 2021 15:22:59 +0800 Subject: remove redundant options --- src/compiler/GF/Command/CommonCommands.hs | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/compiler/GF/Command') diff --git a/src/compiler/GF/Command/CommonCommands.hs b/src/compiler/GF/Command/CommonCommands.hs index 7ca2c0ee4..c685fc525 100644 --- a/src/compiler/GF/Command/CommonCommands.hs +++ b/src/compiler/GF/Command/CommonCommands.hs @@ -176,9 +176,6 @@ commonCommands = fmap (mapCommandExec liftSIO) $ Map.fromList [ flags = [ ("command","the system command applied to the argument") ], - options = [ - ("lines","preserve input lines, and return output as a list of lines") - ], examples = [ mkEx "gt | l | ? wc -- generate trees, linearize, and count words" ] -- cgit v1.2.3