Code coverage report for lib/parser/commands/bzip2.js

Statements: 100% (35 / 35)      Branches: 75% (3 / 4)      Functions: 100% (5 / 5)      Lines: 100% (32 / 32)      Ignored: none     

All files » lib/parser/commands/ » bzip2.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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211                            1 1 1 1 1   1 1 1 1   1                                                                                                                                                   1   1                                                                                                       1         1   1                                                     1 1 1 3 3 3   1   1   1 3 3 3 3       1 1 1 1  
/*
-d --decompress     force decompression
-z --compress       force compression
-k --keep           keep (don't delete) input files
-f --force          overwrite existing output files
-t --test           test compressed file integrity
-c --stdout         output to standard out
-q --quiet          suppress noncritical error messages
-v --verbose        be verbose (a 2nd -v gives more)
-s --small          use less memory (at most 2500k)
-1 .. -9            set block size to 100k .. 900k
--fast              alias for -1
--best              alias for -9
*/
var __extends = this.__extends || function (d, b) {
    for (var p in b) Eif (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var $ = require("../utils/optionsParser");
var parserModule = require("../utils/parserData");
var common = require("../utils/init");
var GraphModule = require("../../common/graph");
 
var selectors = {
    action: {
        name: 'action',
        description: 'action of the algorithm',
        options: {
            compress: {
                name: 'compress',
                option: null,
                description: 'compress the received data'
            },
            decompress: {
                name: 'decompress',
                option: 'd',
                longOption: "decompress",
                description: 'decompress the received data'
            }
        }
    },
    ratio: {
        name: 'ratio',
        description: 'compress ratio of the algorithm',
        options: {
            1: {
                name: '1 - fast',
                option: '1',
                longOption: 'fast',
                description: 'compress the received data'
            },
            2: {
                name: '2',
                option: '2',
                description: 'decompress the received data'
            },
            3: {
                name: '3',
                option: '3',
                description: 'decompress the received data'
            },
            4: {
                name: '4',
                option: '4',
                description: 'decompress the received data'
            },
            5: {
                name: '5',
                option: '5',
                description: 'decompress the received data'
            },
            6: {
                name: '6',
                option: '6',
                description: 'decompress the received data',
                default: true
            },
            7: {
                name: '7',
                option: '7',
                description: 'decompress the received data'
            },
            8: {
                name: '8',
                option: '8',
                description: 'decompress the received data'
            },
            9: {
                name: '9 - best',
                option: '9',
                longOption: 'best',
                description: 'decompress the received data'
            }
        }
    }
};
 
var actionOptions = selectors.action.options;
 
var flags = {
    keep: {
        name: "keep files",
        option: 'k',
        longOption: 'keep',
        description: "keep (don't delete) input files",
        active: false
    },
    force: {
        name: "force",
        option: 'f',
        longOption: 'force',
        description: "overwrite existing output files",
        active: false
    },
    test: {
        name: "test",
        option: 't',
        longOption: 'test',
        description: "test compressed file integrity",
        active: false
    },
    stdout: {
        name: "stdout",
        option: 'c',
        longOption: 'stdout',
        description: "output to standard out",
        active: false
    },
    quiet: {
        name: "quiet",
        option: 'q',
        longOption: 'quiet',
        description: "suppress noncritical error messages",
        active: false
    },
    verbose: {
        name: "verbose",
        option: 'v',
        longOption: 'verbose',
        description: "overwrite existing output files",
        active: false
    },
    small: {
        name: "small",
        longOption: 'small',
        option: 's',
        description: "use less memory (at most 2500k)",
        active: false
    }
};
 
var config = {
    selectors: selectors,
    flags: flags
};
 
var bzipData = new parserModule.ParserData(config);
 
var optionsParser = $.optionParserFromConfig(config);
 
/*
var shortOptions = {
1: $.ignore,
2: $.ignore,
3: $.ignore,
4: $.ignore,
5: $.ignore,
6: $.ignore,
7: $.ignore,
8: $.ignore,
9: $.ignore,
}
var longOptions = {
'decompress': $.sameAs('d'),
'compress': $.sameAs('z'),
'keep': $.sameAs('k'),
'force': $.sameAs('f'),
'test': $.sameAs('t'),
'stdout': $.sameAs('c'),
'quiet': $.sameAs('q'),
'verbose': $.sameAs('v'),
'small': $.sameAs('s'),
'fast': $.sameAs('1'),
'best': $.sameAs('9')
}*/
var BZipComponent = (function (_super) {
    __extends(BZipComponent, _super);
    function BZipComponent() {
        _super.apply(this, arguments);
        this.exec = "bzip2";
        this.files = [];
    }
    return BZipComponent;
})(GraphModule.CommandComponent);
exports.BZipComponent = BZipComponent;
 
function defaultComponentData() {
    var component = new BZipComponent();
    component.selectors = bzipData.componentSelectors;
    component.flags = bzipData.componentFlags;
    return component;
}
;
 
exports.parseCommand = common.commonParseCommand(optionsParser, defaultComponentData);
exports.parseComponent = common.commonParseComponent(bzipData.flagOptions, bzipData.selectorOptions);
exports.VisualSelectorOptions = bzipData.visualSelectorOptions;
exports.componentClass = BZipComponent;