MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / _printHelp

Function _printHelp

lib/commands/help.js:31–89  ·  view source on GitHub ↗
(commandOptions, rawArgs)

Source from the content-addressed store, hash-verified

29 },
30
31 _printHelp(commandOptions, rawArgs) {
32 let rootCommand = new RootCommand({
33 ui: this.ui,
34 project: this.project,
35 commands: this.commands,
36 tasks: this.tasks,
37 });
38
39 if (rawArgs.length === 0) {
40 this.ui.writeLine(rootCommand.printBasicHelp(commandOptions));
41 // Display usage for all commands.
42 this.ui.writeLine('Available commands in ember-cli:');
43 this.ui.writeLine('');
44
45 Object.keys(this.commands).forEach(function (commandName) {
46 this._printHelpForCommand(commandName, false, commandOptions);
47 }, this);
48
49 if (this.project.eachAddonCommand) {
50 this.project.eachAddonCommand((addonName, commands) => {
51 this.commands = commands;
52
53 this.ui.writeLine('');
54 this.ui.writeLine(`Available commands from ${addonName}:`);
55
56 Object.keys(this.commands).forEach(function (commandName) {
57 this._printHelpForCommand(commandName, false, commandOptions);
58 }, this);
59 });
60 }
61 } else {
62 // If args were passed to the help command,
63 // attempt to look up the command for each of them.
64
65 this.ui.writeLine('Requested ember-cli commands:');
66 this.ui.writeLine('');
67
68 if (this.project.eachAddonCommand) {
69 this.project.eachAddonCommand((addonName, commands) => {
70 Object.assign(this.commands, commands);
71 });
72 }
73
74 let multipleCommands = [GenerateCommand.prototype.name].concat(GenerateCommand.prototype.aliases);
75 if (multipleCommands.indexOf(rawArgs[0]) > -1) {
76 let command = rawArgs.shift();
77 if (rawArgs.length > 0) {
78 commandOptions.rawArgs = rawArgs;
79 }
80 rawArgs = [command];
81 }
82
83 // Iterate through each arg beyond the initial 'help' command,
84 // and try to display usage instructions.
85 rawArgs.forEach(function (commandName) {
86 this._printHelpForCommand(commandName, true, commandOptions);
87 }, this);
88 }

Callers

nothing calls this directly

Calls 1

eachAddonCommandMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…