node-loc
Version:
ts-lib [](https://www.npmjs.com/package/ts-lib)
44 lines • 1.52 kB
JavaScript
;
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
const chalk = require("chalk");
const program = require("commander");
const process = require("process");
const directory_1 = require("./directory");
const file_1 = require("./file");
const utils_1 = require("./utils");
program
.version(utils_1.getVersion())
.command('file <path>')
.description('detect a file')
.action(path => {
const info = new file_1.LocFile(path).getInfo();
console.log(chalk.default.cyan(`
path: \t\t${path}
language: \t${info.lang}
total lines: \t${String(info.lines.total)}
code lines: \t${String(info.lines.code)}
comment lines: \t${String(info.lines.comment)}
`));
});
program
.command('dir <pattern>')
.description('detect a directory with a pattern')
.action(pattern => {
const { info, languages } = new directory_1.LocDir(pattern).getInfo();
console.log(chalk.default.cyan(`
\ttotal lines: \t${String(info.total)}
\tcode lines: \t${String(info.code)}
\tcomment lines: \t${String(info.comment)}
\t--------------------${Object.keys(languages).map(key => {
return `\n\t${key} \t ${String(languages[key])}`;
}).join('')}`));
});
program.parse(process.argv);
__export(require("./file"));
__export(require("./directory"));
__export(require("./languages"));
//# sourceMappingURL=index.js.map