import readline from 'readline';

export default function daemon() {
  const rlInterface = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false,
  });

  rlInterface.on('line', (str: string) => {
    console.log('You just typed: ' + str);
  });
}

@@ -27,16 +27,52 @@
 line';%0A%0A
+import Importer from './Importer';%0A%0A
 export d
@@ -255,19 +255,27 @@
 line', (
-str
+jsonCommand
 : string
@@ -293,40 +293,469 @@
 cons
-ole.log('You just typed: ' + str
+t command = JSON.parse(jsonCommand);%0A    const importer = new Importer(%0A      command.fileContent.split('%5Cn'), command.pathToFile);%0A%0A    // TODO: don't automatically invoke function here because of security issues%0A    importer%5Bcommand.command%5D(...command.args).then((result) =%3E %7B%0A      process.stdout.write(%60$%7BJSON.stringify(result)%7D%5Cn%60);%0A    %7D).catch((error) =%3E %7B%0A      // TODO: print entire stack trace here%0A      process.stderr.write(error.toString());%0A    %7D
 );%0A 

Make daemon use Importer