Code coverage report for istanbul/lib/util/help-formatter.js

Statements: 100% (7 / 7)      Branches: 100% (2 / 2)      Functions: 100% (1 / 1)      Lines: 100% (7 / 7)     

All files » istanbul/lib/util/ » help-formatter.js
1 /*
2 Copyright (c) 2012, Yahoo! Inc. All rights reserved.
3 Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
4 */
5
6 1 var OPT_PREFIX = " ",
7 OPT_START = OPT_PREFIX.length,
8 TEXT_START = 14,
9 STOP = 80,
10 wrap = require('wordwrap')(TEXT_START, STOP);
11
12 1 function formatOption(option, helpText) {
13 64 var formattedText = wrap(helpText);
14
15 64 if (option.length > TEXT_START - OPT_START - 2) {
16 46 return OPT_PREFIX + option + '\n' + formattedText;
17 } else {
18 18 return OPT_PREFIX + option + formattedText.substring((OPT_PREFIX + option).length);
19 }
20 }
21
22 1 module.exports = {
23 formatOption: formatOption
24 };