rdb bin updated

pull/697/head
aniket-engg 4 years ago committed by Aniket
parent 7a8b046396
commit eec3090377
  1. 22
      libs/remix-debug/bin/rdb

@ -1,7 +1,11 @@
#!/usr/bin/env node #!/usr/bin/env node
const program = require('commander') import program from 'commander'
const version = require('../package.json').version import { compileStandardWrapper } from 'solc'
import { readFileSync } from 'fs'
import { start } from 'repl'
import { version } from '../package.json'
import { CmdLine } from '../src/cmdline/index'
program program
.command('version') .command('version')
@ -25,14 +29,8 @@ program
.option('--node [url]', 'node to connect to') .option('--node [url]', 'node to connect to')
.parse(process.argv) .parse(process.argv)
const CmdLine = require('../src/cmdline/index')
const solc = require('solc')
const fs = require('fs')
const filename = 'test/sol/simple_storage.sol' const filename = 'test/sol/simple_storage.sol'
const shortFilename = 'simple_storage.sol' const shortFilename = 'simple_storage.sol'
const inputJson = { const inputJson = {
language: 'Solidity', language: 'Solidity',
sources: { sources: {
@ -51,11 +49,11 @@ const inputJson = {
} }
} }
inputJson.sources[shortFilename] = {content: fs.readFileSync(filename).toString()} inputJson.sources[shortFilename] = {content: readFileSync(filename).toString()}
console.log('compiling...') console.log('compiling...')
const compilationData = JSON.parse(solc.compileStandardWrapper(JSON.stringify(inputJson))) const compilationData = JSON.parse(compileStandardWrapper(JSON.stringify(inputJson)))
const compilation = {} const compilation = {}
compilation.data = compilationData compilation.data = compilationData
compilation.source = { sources: inputJson.sources } compilation.source = { sources: inputJson.sources }
@ -73,9 +71,7 @@ cmdLine.events.on('source', () => {
cmdLine.getSource().forEach(console.dir) cmdLine.getSource().forEach(console.dir)
}) })
const repl = require('repl') start({
repl.start({
prompt: '> ', prompt: '> ',
eval: (cmd, context, filename, cb) => { eval: (cmd, context, filename, cb) => {
let command = cmd.trim() let command = cmd.trim()

Loading…
Cancel
Save