2018-10-21 04:52:36 +02:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2018-10-19 01:10:21 +02:00
|
|
|
import { getSolidpkg, ISolidSimple, Product, verifyProductName } from 'ssn';
|
2018-10-23 05:02:11 +02:00
|
|
|
import parseArguments from './funcs/parseArguments';
|
2018-10-19 01:10:21 +02:00
|
|
|
|
2018-10-23 05:02:11 +02:00
|
|
|
const { args, fail } = parseArguments({
|
|
|
|
product: { short: 'p', description: 'Name of the product we want to get the solidpkg on', verify: verifyProductName },
|
|
|
|
from: { short: 'f', description: 'Number of the from release', verify: (str) => str.match(/^(-1|0|[1-9][0-9]{0,2})$/) !== null },
|
|
|
|
to: { short: 't', description: 'Number of the to release', verify: (str) => str.match(/^(0|[1-9][0-9]{0,2})$/) !== null },
|
|
|
|
});
|
2018-10-19 01:10:21 +02:00
|
|
|
|
|
|
|
//Get solidpkg and write output to stdout
|
2018-10-23 05:02:11 +02:00
|
|
|
getSolidpkg(args.product as Product, Number(args.from), Number(args.to)).then((output: ISolidSimple) => {
|
2018-10-19 01:10:21 +02:00
|
|
|
process.stdout.write(JSON.stringify(output));
|
2018-10-21 04:13:32 +02:00
|
|
|
}).catch((error) => {
|
2018-10-23 05:02:11 +02:00
|
|
|
fail(error);
|
2018-10-19 01:10:21 +02:00
|
|
|
});
|