diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-06-13 12:49:54 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-06-13 12:49:54 +0000 |
| commit | 4b1faf4ae547b995e8d6cd9841e63791cbe1bebb (patch) | |
| tree | fb9d82fab5982f5ee73eebbad5bc0b1b9d70c9e4 /src-3.0/GF/Command | |
| parent | 3b15ade685f0281d67eba079391981a822e68a23 (diff) | |
make with test trees
Diffstat (limited to 'src-3.0/GF/Command')
| -rw-r--r-- | src-3.0/GF/Command/Commands.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src-3.0/GF/Command/Commands.hs b/src-3.0/GF/Command/Commands.hs index 9ed57f376..b37143c90 100644 --- a/src-3.0/GF/Command/Commands.hs +++ b/src-3.0/GF/Command/Commands.hs @@ -66,6 +66,15 @@ commandHelp full (co,info) = unlines $ [ -- this list must no more be kept sorted by the command name allCommands :: PGF -> Map.Map String CommandInfo allCommands pgf = Map.fromList [ + ("af", emptyCommandInfo { + longname = "append_file", + synopsis = "append string or tree to a file", + exec = \opts arg -> do + let file = valIdOpts "file" "_gftmp" opts + appendFile file (toString arg) + return void, + flags = ["file"] + }), ("cc", emptyCommandInfo { longname = "compute_concrete", synopsis = "computes concrete syntax term using the source grammar", @@ -225,14 +234,16 @@ allCommands pgf = Map.fromList [ ], options = ["lines","term"], exec = \opts arg -> do - s <- readFile (toString arg) + let file = valIdOpts "file" "_gftmp" opts + s <- readFile file return $ case opts of _ | isOpt "lines" opts && isOpt "term" opts -> fromTrees [t | l <- lines s, Just t <- [readExp l]] _ | isOpt "term" opts -> fromTrees [t | Just t <- [readExp s]] _ | isOpt "lines" opts -> fromStrings $ lines s - _ -> fromString s + _ -> fromString s, + flags = ["file"] }), ("wf", emptyCommandInfo { longname = "write_file", @@ -240,7 +251,8 @@ allCommands pgf = Map.fromList [ exec = \opts arg -> do let file = valIdOpts "file" "_gftmp" opts writeFile file (toString arg) - return void + return void, + flags = ["file"] }) ] where |
