1module TutorialD.Interpreter.Import.TutorialD where
3import TutorialD.Interpreter.Import.Base
4import TutorialD.Interpreter.Base hiding (try)
5import TutorialD.Interpreter.DatabaseContextExpr
7import qualified ProjectM36.Error as PM36E
8import qualified Data.Text as T
9import Control.Exception
10import qualified Data.ByteString as BS
11import qualified Data.Text.Encoding as TE
12--import a file containing TutorialD database context expressions
14importTutorialD :: FilePath -> IO (Either RelationalError DatabaseContextExpr)
15importTutorialD pathIn = do
16 eTutdBytes <- try (BS.readFile pathIn) :: IO (Either IOError BS.ByteString)
18 Left err -> return $ Left (ImportError $ T.pack (show err))
20 case TE.decodeUtf8' tutdBytes of
21 Left err -> pure (Left (ImportError $ T.pack (show err)))
23 case parse multipleDatabaseContextExprP "import" tutdUtf8 of
24 --parseErrorPretty is new in megaparsec 5
25 Left err -> pure (Left (PM36E.ParseError (T.pack (show err))))
26 Right expr -> pure (Right expr)
28tutdImportP :: Parser DatabaseContextDataImportOperator
30 reserved ":importtutd"
33 return $ DatabaseContextDataImportOperator (T.unpack path) importTutorialD
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list