cs142/project2/node_modules/cli/examples/cat.js
2020-08-01 19:26:11 -03:00

17 lines
354 B
JavaScript
Executable File

#!/usr/bin/env node
var cli = require('cli');
var output_file = function (file) {
cli.withInput(file, function (line, sep, eof) {
if (!eof) {
cli.output(line + sep);
} else if (cli.args.length) {
output_file(cli.args.shift());
}
});
};
if (cli.args.length) {
output_file(cli.args.shift());
}