forked from GitHub/gf-core
GF shell: write_file now writes one tree per line
This compensates for other changes that removed line breaks. Maybe it should have a -lines options like ps and rf?
This commit is contained in:
@@ -49,7 +49,7 @@ void = Piped ([],"")
|
|||||||
stringAsExpr = H.ELit . H.LStr -- should be a pattern macro
|
stringAsExpr = H.ELit . H.LStr -- should be a pattern macro
|
||||||
|
|
||||||
-- ** Converting command input
|
-- ** Converting command input
|
||||||
toString = unwords . toStrings
|
|
||||||
toStrings = map showAsString
|
toStrings = map showAsString
|
||||||
where
|
where
|
||||||
showAsString t = case t of
|
showAsString t = case t of
|
||||||
|
|||||||
@@ -193,8 +193,8 @@ commonCommands = fmap (mapCommandExec liftSIO) $ Map.fromList [
|
|||||||
exec = \opts arg-> do
|
exec = \opts arg-> do
|
||||||
let file = valStrOpts "file" "_gftmp" opts
|
let file = valStrOpts "file" "_gftmp" opts
|
||||||
if isOpt "append" opts
|
if isOpt "append" opts
|
||||||
then restricted $ appendFile file (toString arg)
|
then restricted $ appendFile file (toLines arg)
|
||||||
else restricted $ writeUTF8File file (toString arg)
|
else restricted $ writeUTF8File file (toLines arg)
|
||||||
return void,
|
return void,
|
||||||
options = [
|
options = [
|
||||||
("append","append to file, instead of overwriting it")
|
("append","append to file, instead of overwriting it")
|
||||||
@@ -259,3 +259,7 @@ trie = render . pptss . H.toTrie . map H.toATree
|
|||||||
H.Oth e -> pp (H.showExpr [] e)
|
H.Oth e -> pp (H.showExpr [] e)
|
||||||
H.Ap f [[]] -> pp (H.showCId f)
|
H.Ap f [[]] -> pp (H.showCId f)
|
||||||
H.Ap f tss -> H.showCId f $$ nest 2 (pptss tss)
|
H.Ap f tss -> H.showCId f $$ nest 2 (pptss tss)
|
||||||
|
|
||||||
|
-- ** Converting command input
|
||||||
|
toString = unwords . toStrings
|
||||||
|
toLines = unlines . toStrings
|
||||||
Reference in New Issue
Block a user