MCPcopy Index your code
hub / github.com/nodejs/node / print

Function print

lib/internal/main/print_help.js:203–232  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

201}
202
203function print(stream) {
204 const { options, aliases } = getCLIOptionsInfo();
205 const console = require('internal/console/global');
206
207 // Use 75 % of the available width, and at least 70 characters.
208 const width = MathMax(70, (stream.columns || 0) * 0.75);
209 const firstColumn = MathFloor(width * 0.4);
210 const secondColumn = MathFloor(width * 0.57);
211
212 options.set('-', { helpText: 'script read from stdin ' +
213 '(default if no file name is provided, ' +
214 'interactive mode if a tty)' });
215 options.set('--', { helpText: 'indicate the end of node options' });
216 let helpText = (
217 'Usage: node [options] [ script.js ] [arguments]\n' +
218 ' node inspect [options] [ script.js | host:port ] [arguments]\n\n' +
219 'Options:\n');
220 helpText += (indent(format({
221 options, aliases, firstColumn, secondColumn,
222 }), 2));
223
224 helpText += ('\nEnvironment variables:\n');
225
226 helpText += (format({
227 options: envVars, firstColumn, secondColumn,
228 }));
229
230 helpText += ('\nDocumentation can be found at https://nodejs.org/');
231 console.log(helpText);
232}
233
234prepareMainThreadExecution();
235

Callers 1

print_help.jsFile · 0.70

Calls 5

indentFunction · 0.70
formatFunction · 0.70
requireFunction · 0.50
setMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected