<commit_before>#!/usr/bin/env node

'use strict';

const logSymbols = require('log-symbols');
const meow = require('meow');
const path = require('path');
const updateNotifier = require('update-notifier');

const updateV8 = require('.');

const cli = meow(`
Usage
  $ update-v8 <type> [options]
  
  Type can be: major | minor | backport

Options
  --node-dir Specify the directory of a Node.js clone. Default is cwd.
  --verbose Enable verbose output.
  --branch Specify a branch for major update.
  --sha Specify the SHA of the commit to backport.
`);

updateNotifier({pkg: cli.pkg}).notify();

const defaultOptions = {
    nodeDir: process.cwd(),
    branch: 'lkgr',
    verbose: false
};

return Promise
    .resolve()
    .then(() => {
        if (cli.input.length !== 1) {
            cli.showHelp();
        } else {
            const options = Object.assign({}, defaultOptions, cli.flags);
            options.nodeDir = path.resolve(options.nodeDir);
            switch (cli.input[0].toLowerCase()) {
                case 'minor':
                    return updateV8.minor(options);
                case 'major':
                    return updateV8.major(options);
                case 'backport':
                    return updateV8.backport(options);
                default:
                    cli.showHelp();
            }
        }
    })
    .catch(err => {
        console.error(logSymbols.error, err.message);
        process.exitCode = 1;
    });<commit_msg>feat: print stack trace when verbose is enabled<commit_after>#!/usr/bin/env node

'use strict';

const logSymbols = require('log-symbols');
const meow = require('meow');
const path = require('path');
const updateNotifier = require('update-notifier');

const updateV8 = require('.');

const cli = meow(`
Usage
  $ update-v8 <type> [options]
  
  Type can be: major | minor | backport

Options
  --node-dir Specify the directory of a Node.js clone. Default is cwd.
  --verbose Enable verbose output.
  --branch Specify a branch for major update.
  --sha Specify the SHA of the commit to backport.
`);

updateNotifier({pkg: cli.pkg}).notify();

const defaultOptions = {
    nodeDir: process.cwd(),
    branch: 'lkgr',
    verbose: false
};

const options = Object.assign({}, defaultOptions, cli.flags);
options.nodeDir = path.resolve(options.nodeDir);

return Promise
    .resolve()
    .then(() => {
        if (cli.input.length !== 1) {
            cli.showHelp();
        } else {
            switch (cli.input[0].toLowerCase()) {
                case 'minor':
                    return updateV8.minor(options);
                case 'major':
                    return updateV8.major(options);
                case 'backport':
                    return updateV8.backport(options);
                default:
                    cli.showHelp();
            }
        }
    })
    .catch(err => {
        console.error(logSymbols.error, options.verbose ? err.stack : err.message);
        process.exitCode = 1;
    });
{'fraction_non_alphanumeric': 0.1327315279170846, 'fraction_numerical': 0.005349381477766633, 'mean_word_length': 2.1199165797705946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7596528', 'n_tokens_mistral': 895, 'n_tokens_neox': 865, 'n_words': 231}