Last active
February 13, 2020 11:29
-
-
Save tysg/bc78a7cf263f1c736fa60a02c7b4906f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import { createContext, parseError, runInContext } from '../index' | |
| const fs = require('fs') | |
| function main() { | |
| const chapter = 4 | |
| const path = process.argv[2] | |
| const code = fs.readFileSync(path, 'utf8') | |
| const context = createContext(chapter) | |
| runInContext(code, context).then(obj => { | |
| if (obj.status === 'finished') { | |
| console.log(obj.value) | |
| } else { | |
| console.log(parseError(context.errors)) | |
| } | |
| }) | |
| } | |
| main() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create a new file
src/repl/cli.tsusing the code, rebuild usingyarn buildand run usingnode dist/repl/cli.js [FILE]