markdowny/src/sections.ts
D. Moonfire dce80229c9 Refactoring layout to fit with a different standard.
- Same directory for the source and library files.
- Switched from dotted to lodash directly.
- tscconfig.json moved up a level.
- Updated TypeScript packages.
	- Updated various files that were now throwing errors.
2017-10-19 18:39:45 -05:00

41 lines
928 B
TypeScript

import * as _ from "lodash";
import * as comma from "add-commas";
import * as markdownTable from "markdown-table";
import * as scanner from "./scanner";
export var help = "Create a summary table of requested fields";
export function args(argv) {
return argv
.help("help")
.alias('f', 'field')
.default('field', 'summary')
.alias('t', 'title')
.default('title', 'title')
.alias('o', 'output')
.default('output', '-')
.demand(1)
.argv;
}
export function run(argv) {
var files = argv._.splice(1);
var data = scanner.scanFiles(argv, files);
render(argv, data);
}
export function render(argv, data) {
for (var item of data) {
var title = _.get(item, argv.title);
var value = _.get(item, argv.field);
console.log(`# ${title}`);
console.log();
console.log(value.replace("\n", "\n\n"));
}
}