* Generate a summary of all the options with corresponding help text. * @returns {string}
()
| 183 | * @returns {string} |
| 184 | */ |
| 185 | help() { |
| 186 | const options = { |
| 187 | names: [], |
| 188 | descriptions: [] |
| 189 | }; |
| 190 | |
| 191 | this._options.forEach(option => { |
| 192 | let name = ''; |
| 193 | |
| 194 | // don't show ignored options |
| 195 | if (option.ignore) { |
| 196 | return; |
| 197 | } |
| 198 | |
| 199 | if (option.shortName) { |
| 200 | name += `-${option.shortName}${option.longName ? ', ' : ''}`; |
| 201 | } |
| 202 | |
| 203 | if (option.longName) { |
| 204 | name += `--${option.longName}`; |
| 205 | } |
| 206 | |
| 207 | if (option.hasValue) { |
| 208 | name += ' <value>'; |
| 209 | } |
| 210 | |
| 211 | options.names.push(name); |
| 212 | options.descriptions.push(option.helpText); |
| 213 | }); |
| 214 | |
| 215 | return `Options:\n${formatHelpInfo(options).join('\n')}`; |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Get the options. |
no test coverage detected