Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/yeoman-generator/lib/actions/ |
Upload File : |
'use strict'; const path = require('path'); const fs = require('fs'); const _ = require('lodash'); const table = require('text-table'); /** * @mixin * @alias actions/help */ const help = module.exports; /** * Tries to get the description from a USAGE file one folder above the * source root otherwise uses a default description * * @return {String} Help message of the generator */ help.help = function() { const filepath = path.resolve(this.sourceRoot(), '../USAGE'); const exists = fs.existsSync(filepath); let out = ['Usage:', ' ' + this.usage(), '']; // Build options if (Object.keys(this._options).length > 0) { out = out.concat(['Options:', this.optionsHelp(), '']); } // Build arguments if (this._arguments.length > 0) { out = out.concat(['Arguments:', this.argumentsHelp(), '']); } // Append USAGE file is any if (exists) { out.push(fs.readFileSync(filepath, 'utf8')); } return out.join('\n'); }; function formatArg(config) { let arg = `<${config.name}>`; if (!config.required) { arg = `[${arg}]`; } return arg; } /** * Output usage information for this given generator, depending on its arguments * or options * * @return {String} Usage information of the generator */ help.usage = function() { const options = Object.keys(this._options).length ? '[options]' : ''; let name = this.options.namespace; let args = ''; if (this._arguments.length > 0) { args = this._arguments.map(formatArg).join(' ') + ' '; } name = name.replace(/^yeoman:/, ''); let out = `yo ${name} ${args}${options}`; if (this.description) { out += '\n\n' + this.description; } return out; }; /** * Simple setter for custom `description` to append on help output. * * @param {String} description */ help.desc = function(description) { this.description = description || ''; return this; }; /** * Get help text for arguments * @returns {String} Text of options in formatted table */ help.argumentsHelp = function() { const rows = this._arguments.map(config => { return [ '', config.name ? config.name : '', config.description ? `# ${config.description}` : '', config.type ? `Type: ${config.type.name}` : '', `Required: ${config.required}` ]; }); return table(rows); }; /** * Get help text for options * @returns {String} Text of options in formatted table */ help.optionsHelp = function() { const options = _.reject(this._options, x => x.hide); const rows = options.map(opt => { return [ '', opt.alias ? `-${opt.alias}, ` : '', `--${opt.name}`, opt.description ? `# ${opt.description}` : '', opt.default !== undefined && opt.default !== '' ? 'Default: ' + opt.default : '' ]; }); return table(rows); };