feat(extract): added the ability to extract metadata directly
This commit is contained in:
parent
3bb5570878
commit
7b6ae6a903
1 changed files with 29 additions and 0 deletions
29
src/tools/extract.ts
Normal file
29
src/tools/extract.ts
Normal file
|
@ -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));
|
||||||
|
}
|
Loading…
Reference in a new issue