保誠-保戶業務員媒合平台
Tomas
2022-05-19 957a1f10a06fdbb76f1a0ba94fe44126c613fee3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*!
 * @nuxt/cli v2.15.8 (c) 2016-2021
 * Released under the MIT License
 * Repository: https://github.com/nuxt/nuxt.js
 * Website: https://nuxtjs.org
*/
'use strict';
 
const consola = require('consola');
const index = require('./cli-index.js');
const chalk = require('chalk');
require('@nuxt/utils');
require('@nuxt/config');
require('path');
require('exit');
require('std-env');
require('wrap-ansi');
require('boxen');
require('minimist');
require('hable');
require('defu');
require('semver');
require('fs');
require('execa');
 
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
 
const consola__default = /*#__PURE__*/_interopDefaultLegacy(consola);
const chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
 
async function listCommands () {
  const commandsOrder = ['dev', 'build', 'generate', 'start', 'help'];
 
  // Load all commands
  const _commands = await Promise.all(
    commandsOrder.map(cmd => index.getCommand(cmd))
  );
 
  let maxLength = 0;
  const commandsHelp = [];
 
  for (const command of _commands) {
    commandsHelp.push([command.usage, command.description]);
    maxLength = Math.max(maxLength, command.usage.length);
  }
 
  const _cmds = commandsHelp.map(([cmd, description]) => {
    const i = index.indent(maxLength + index.optionSpaces - cmd.length);
    return index.foldLines(
      chalk__default['default'].green(cmd) + i + description,
      index.startSpaces + maxLength + index.optionSpaces * 2,
      index.startSpaces + index.optionSpaces
    )
  }).join('\n');
 
  const usage = index.foldLines('Usage: nuxt <command> [--help|-h]', index.startSpaces);
  const cmds = index.foldLines('Commands:', index.startSpaces) + '\n\n' + _cmds;
 
  process.stderr.write(index.colorize(`${usage}\n\n${cmds}\n\n`));
}
 
const help = {
  name: 'help',
  description: 'Shows help for <command>',
  usage: 'help <command>',
  options: {
    help: index.common.help,
    version: index.common.version
  },
  async run (cmd) {
    const [name] = cmd._argv;
    if (!name) {
      return listCommands()
    }
    const command = await index.getCommand(name);
 
    if (!command) {
      consola__default['default'].info(`Unknown command: ${name}`);
      return
    }
 
    index.NuxtCommand.from(command).showHelp();
  }
};
 
exports.default = help;