Code coverage report for src/options.js

Statements: 100% (4 / 4)      Branches: 100% (0 / 0)      Functions: 100% (0 / 0)      Lines: 100% (4 / 4)      Ignored: none     

All files » src/ » options.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96                    1 1 1             1                                                                                                                                                        
/**
 * @fileoverview Options configuration for optionator.
 * @author idok
 */
'use strict';
 
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
 
var optionator = require('optionator');
var pkg = require('../package.json');
var reactDOMSupport = require('./reactDOMSupport');
 
//------------------------------------------------------------------------------
// Initialization and Public Interface
//------------------------------------------------------------------------------
 
// exports 'parse(args)', 'generateHelp()', and 'generateHelpForOption(optionName)'
module.exports = optionator({
    prepend: [
        pkg.name + ' v' + pkg.version,
        pkg.description,
        '',
        'Usage:',
        '$ rt <filename> [<filename> ...] [<args>]'
    ].join('\n'),
    concatRepeatedArrays: true,
    mergeRepeatedObjects: true,
    options: [{
        heading: 'Options'
    }, {
        option: 'help',
        alias: 'h',
        type: 'Boolean',
        description: 'Show help.'
    }, {
        option: 'color',
        alias: 'c',
        default: 'true',
        type: 'Boolean',
        description: 'Use colors in output.'
    }, {
        option: 'modules',
        alias: 'm',
        default: 'none',
        type: 'String',
        description: 'Use output modules. (amd|commonjs|none)'
    }, {
        option: 'name',
        alias: 'n',
        type: 'String',
        description: 'When using globals, the name for the variable. The default is the [file name]RT, when using amd, the name of the module'
    }, {
        option: 'dry-run',
        alias: 'd',
        default: 'false',
        type: 'Boolean',
        description: 'Run compilation without creating an output file, used to check if the file is valid'
    }, {
        option: 'force',
        alias: 'r',
        default: 'false',
        type: 'Boolean',
        description: 'Force creation of output. skip file check.'
    }, {
        option: 'format',
        alias: 'f',
        type: 'String',
        default: 'stylish',
        //enum: ['stylish', 'json'],
        description: 'Use a specific output format. (stylish|json)'
    }, {
        option: 'target-version',
        alias: 't',
        type: 'String',
        default: '0.12.2',
        description: 'React version to generate code for (' + Object.keys(reactDOMSupport).join(', ') + ')'
    }, {
        option: 'list-target-version',
        type: 'Boolean',
        default: 'false',
        description: 'Show list of target versions'
    }, {
        option: 'version',
        alias: 'v',
        type: 'Boolean',
        description: 'Outputs the version number.'
    }, {
        option: 'stack',
        alias: 'k',
        type: 'Boolean',
        description: 'Show stack trace on errors.'
    }]
});