51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.register = void 0;
|
|
const __1 = require("../");
|
|
const _cli_1 = require("../_cli");
|
|
const path = require("path");
|
|
const osr_commons_1 = require("@plastichub/osr-commons");
|
|
const defaultOptions = (yargs) => {
|
|
return yargs.option('debug', {
|
|
default: 'false',
|
|
describe: 'debug messages'
|
|
}).option('verb', {
|
|
description: 'search api: scaleserp',
|
|
default: 'scaleserp'
|
|
}).option('location', {
|
|
description: 'location to be searched from',
|
|
default: 'Berlin, Germany'
|
|
}).option('query', {
|
|
description: 'the query',
|
|
default: 'Precious Plastic Munich'
|
|
}).option('dst', {
|
|
description: 'dst output path, supports XLS|CSV|HTML',
|
|
default: './tests/data/serpwow.json'
|
|
}).option('env_key', {
|
|
default: 'OSR-CONFIG',
|
|
describe: 'Environment key to the config path'
|
|
});
|
|
};
|
|
let options = (yargs) => defaultOptions(yargs);
|
|
const register = (cli) => {
|
|
return cli.command('info <verb>', 'Search', options, async (argv) => {
|
|
(0, _cli_1.defaults)();
|
|
if (argv.help) {
|
|
return;
|
|
}
|
|
const args = argv;
|
|
const config = (0, osr_commons_1.CONFIG_DEFAULT)(args.env_key);
|
|
const opts = {
|
|
verb: argv.verb,
|
|
query: argv.query,
|
|
dst: path.resolve(args.dst)
|
|
};
|
|
if (!opts.verb) {
|
|
__1.logger.error('No verb specified');
|
|
return;
|
|
}
|
|
__1.logger.debug(`Reading OSR Config with key "${argv.env_key}"`, opts);
|
|
});
|
|
};
|
|
exports.register = register;
|
|
//# sourceMappingURL=info.js.map
|