From 7b6ae6a903f85467a598258eaa5513a1b7f0b210 Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Tue, 18 Aug 2020 01:00:20 -0500 Subject: [PATCH] feat(extract): added the ability to extract metadata directly --- src/tools/extract.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/tools/extract.ts diff --git a/src/tools/extract.ts b/src/tools/extract.ts new file mode 100644 index 0000000..473e473 --- /dev/null +++ b/src/tools/extract.ts @@ -0,0 +1,29 @@ +import * as _ from "lodash"; +import * as yargs from "yargs"; +import * as scanner from "../scanner"; + +export var command = "extract"; +export var describe = "Extracts a YAML from a list of files"; + +export function builder(yargs: yargs.Arguments) +{ + return yargs + .help("help") + + .alias("o", "output") + .default("output", "-") + + .demand(1); +} + +export function handler(argv: any) +{ + var files = argv._.splice(1); + var data = scanner.scanFiles(argv, files); + render(argv, data); +} + +export function render(argv, data) +{ + console.log(JSON.stringify(data)); +}