UNPKG

google-it

Version:

A CLI and Node.js library to help retrieve, display, and store Google search results

30 lines (22 loc) 683 B
#! /usr/bin/env node /* eslint-disable no-console */ "use strict"; var ora = require('ora'); var theSpinner = ora({ text: 'Loading results', color: 'cyan' }).start(); var parseCommandLineArgs = require('./parseCommandLineArgs'); var validateCLIArguments = require('./validateCLIArguments'); var googleIt = require('./main'); var cliOptions = parseCommandLineArgs(process.argv); var validation = validateCLIArguments(cliOptions); if (!validation.valid) { console.log("Invalid options. Error: ".concat(validation.error)); theSpinner.clear(); } else { googleIt(cliOptions).then(function () { theSpinner.stop(); theSpinner.clear(); }).catch(console.error); }