-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc9f840
commit ce753e7
Showing
6 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello world. This file is written to test the expansions of kb_example.csv. We should see that @@hl is expanded to hello. This is a @@thm, which we cannot @@prf. No @@lmm or @@ax can be used, because this is not a scientific theorem. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello world. This file is written to test the expansions of kb_example.csv. We should see that hello is expanded to hello. This is a theorem, which we cannot proof. No lemma or axiom can be used, because this is not a scientific theorem. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,14 @@ Stability : experimental | |
|
||
module LibCli.Main where | ||
|
||
import qualified LibCli.Spec as CS (ShortHndr (..), cliModes) | ||
import qualified System.Console.CmdArgs as CMD | ||
import LibCli.Spec (ShortHndr (input, out)) | ||
import qualified LibCli.Spec as CS (ShortHndr (..), cliModes) | ||
import LibCore.Decoder (decode) | ||
import LibCore.KnowledgeBase (getKnowledgeBase) | ||
import LibCore.Mapper (mapParseStructure) | ||
import LibCore.OutputInterface (returnOutput) | ||
import LibCore.Parser (doParse) | ||
import qualified System.Console.CmdArgs as CMD | ||
|
||
----------------------- | ||
-- Command Handlers: -- | ||
|
@@ -19,13 +25,24 @@ import qualified System.Console.CmdArgs as CMD | |
-- TODO(tech-debt): define a typeclass for the modes instead of the pattern matching | ||
-- TODO: (future task) implement the actual handlers with the business logic. | ||
mockCliHandler :: CS.ShortHndr -> IO () | ||
mockCliHandler c@CS.Replace{} = print $ "replacing! --> " ++ show c | ||
-- mockCliHandler [email protected]{} = print $ "replacing! --> " ++ show c | ||
mockCliHandler c@CS.Replace{} = replaceMode c | ||
mockCliHandler c@CS.Expand{} = print $ "expanding! --> " ++ show c | ||
mockCliHandler c@CS.List{} = print $ "listing! --> " ++ show c | ||
mockCliHandler c@CS.Add{} = print $ "adding! --> " ++ show c | ||
mockCliHandler c@CS.Update{} = print $ "updating! --> " ++ show c | ||
mockCliHandler c@CS.Delete{} = print $ "deleting! --> " ++ show c | ||
|
||
replaceMode :: ShortHndr -> IO () | ||
replaceMode c@CS.Replace {} = do | ||
case input c of | ||
Nothing -> error "No input file was found" | ||
Just f -> do | ||
s <- readFile f | ||
returnOutput (out c) (decode $ mapParseStructure getKnowledgeBase $ doParse s) | ||
-- Impossible case because of the mockCliHandler | ||
replaceMode _ = undefined | ||
|
||
---------------------------- | ||
-- Executable entrypoiny: -- | ||
---------------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters