#!/usr/bin/env node
'use strict';
const program = require('commander');
const addLineNumbers = require('add-line-numbers');
const fs = require('fs');
const listAndRun = require('./list-and-run').listAndRun;
const path = '/tmp/te';

program.parse(process.argv);

const line = '\n' + program.args;
fs.appendFileSync(path, line);

listAndRun();

#!/usr/bin/env node
'use strict';
const program = require('commander');
const fs = require('fs');
const listAndRun = require('./list-and-run').listAndRun;
const path = '/tmp/te';

program.parse(process.argv);

const line = program.args;
const file = fs.readFileSync(path, 'utf8');

var lines = [];
if (file.length) {
    var lines = file.split('\n');
}
lines.push(line);

fs.writeFileSync(path, lines.join('\n'));

listAndRun();

Make sure append doesn't create an empty line when the first line of code is added
Make sure append doesn't create an empty line when the first line of code is added
