From 87e64a804cbe5848d20f0555dedae42e1516cbbc Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 13 Aug 2015 10:49:50 +0000 Subject: GF Shell: refactoring for improved modularity and reusability: + Generalize the CommandInfo type by parameterizing it on the monad instead of just the environment. + Generalize the commands defined in GF.Command.{Commands,Commands2,CommonCommands,SourceCommands,HelpCommand} to work in any monad that supports the needed operations. + Liberate GF.Command.Interpreter from the IO monad. Also, move the current PGF from CommandEnv to GFEnv in GF.Interactive, making the command interpreter even more generic. + Use a state monad to maintain the state of the interpreter in GF.{Interactive,Interactive2}. --- src/compiler/GF/Command/Help.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/compiler/GF/Command/Help.hs') diff --git a/src/compiler/GF/Command/Help.hs b/src/compiler/GF/Command/Help.hs index a1a4716ee..2a736088d 100644 --- a/src/compiler/GF/Command/Help.hs +++ b/src/compiler/GF/Command/Help.hs @@ -12,7 +12,7 @@ commandHelpAll' allCommands opts = unlines $ commandHelp' opts = if isOpt "t2t" opts then commandHelpTags else commandHelp -commandHelp :: Bool -> (String,CommandInfo env) -> String +--commandHelp :: Bool -> (String,CommandInfo env) -> String commandHelp full (co,info) = unlines . compact $ [ co ++ optionally (", " ++) (longname info), synopsis info] ++ if full then [ @@ -26,7 +26,7 @@ commandHelp full (co,info) = unlines . compact $ [ -- for printing with txt2tags formatting -commandHelpTags :: Bool -> (String,CommandInfo env) -> String +--commandHelpTags :: Bool -> (String,CommandInfo env) -> String commandHelpTags full (co,info) = unlines . compact $ [ "#VSPACE","", "===="++hdrname++"====", @@ -75,7 +75,7 @@ helpCommand allCommands = ("license","show copyright and license information"), ("t2t","output help in txt2tags format") ], - exec = \_ opts ts -> + exec = \opts ts -> let msg = case ts of _ | isOpt "changes" opts -> changesMsg -- cgit v1.2.3