function processArgv(defaultConfigPath) { const options = getopts(process.argv.slice(2)) || {}; if (Array.isArray(options.config)) { console.log( chalk.red( `Starting servers requires a single config path. Multiple were passed.` ) ); process.exit(9); } const config = typeof options.config === 'string' ? options.config : defaultConfigPath; const log = createToolingLog(pickLevelFromFlags(options)); log.pipe(process.stdout); return { config, log, installDir: options.kibanaInstallDir, help: options.help, rest: options._, }; }
function processArgs(defaultConfigPaths) { // If no args are passed, use {} const options = getopts(process.argv.slice(2)) || {}; // If --config is passed without paths, it's "true", so use default const configs = typeof options.config === 'string' || Array.isArray(options.config) ? [].concat(options.config) : defaultConfigPaths; const log = createToolingLog(pickLevelFromFlags(options)); log.pipe(process.stdout); return { configs, log, help: options.help, bail: options.bail, rest: options._, }; }
import { generateNoticeFromSource } from './generate_notice_from_source'; const unknownFlags = []; const opts = getopts(process.argv.slice(2), { boolean: [ 'help', 'validate', 'verbose', 'debug', ], unknown(flag) { unknownFlags.push(flag); } }); const log = createToolingLog(pickLevelFromFlags(opts)); log.pipe(process.stdout); if (unknownFlags.length) { log.error(`Unknown flags ${unknownFlags.map(f => `"${f}"`).join(',')}`); process.exitCode = 1; opts.help = true; } if (opts.help) { process.stdout.write('\n' + dedent` Generate or validate NOTICE.txt. Entries are collected by finding all multi-line comments that start with a "@notice" tag and copying their text content into NOTICE.txt.
const unknownFlags = []; const flags = getopts(process.argv, { boolean: [ 'watch', 'dev', 'help', 'debug' ], unknown(name) { unknownFlags.push(name); } }); const log = new ToolingLog({ level: pickLevelFromFlags(flags), writeTo: process.stdout }); if (unknownFlags.length) { log.error(`Unknown flag(s): ${unknownFlags.join(', ')}`); flags.help = true; process.exitCode = 1; } if (flags.help) { log.info(` Simple build tool for @kbn/interpreter package --dev Build for development, include source maps --watch Run in watch mode
--skip-archives {dim Don't produce tar/zip archives} --skip-os-packages {dim Don't produce rpm/deb packages} --rpm {dim Only build the rpm package} --deb {dim Only build the deb package} --release {dim Produce a release-ready distributable} --skip-node-download {dim Reuse existing downloads of node.js} --verbose,-v {dim Turn on verbose logging} --no-debug {dim Turn off debug logging} `) + '\n' ); process.exit(1); } const log = new ToolingLog({ level: pickLevelFromFlags(flags, { default: flags.debug === false ? 'info' : 'debug' }), writeTo: process.stdout }); function isOsPackageDesired(name) { if (flags['skip-os-packages']) { return false; } // build all if no flags specified if (flags.rpm === undefined && flags.deb === undefined) { return true; } return Boolean(flags[name]);
function createLogger() { return new ToolingLog({ level: pickLevelFromFlags(userOptions), writeTo: process.stdout, }); }
function createLogger() { const log = createToolingLog(pickLevelFromFlags(userOptions)); log.pipe(process.stdout); return log; }