Skip to content

Commit

Permalink
new array keyword "raw" added to options. this allows to add raw data…
Browse files Browse the repository at this point in the history
… to the switches, its needed when needing more control over 7zip. For example, if you want to only list out two file extensions you would need to put -i!*.jpg -i!*.png on the command line, doing so with options {i:, i:} doesn't work since the repeat switch overrides the first one.
  • Loading branch information
sketchpunk committed Sep 17, 2015
1 parent faca0ac commit 797d86a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions util/switches.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';
var util = require('util');

/**
* Transform an object of options into an array that can be passed to the
Expand Down Expand Up @@ -37,8 +38,9 @@ module.exports = function (switches) {
// Special treatment for wilcards
if (s === 'wildcards') {
a.unshift(switches.wildcards);
}
else if (switches[s].indexOf(' ') === -1) {
}else if (s === 'raw' && util.isArray(switches.raw)){ //Allow raw switches to be added to the command, repeating switches like -i is not possible otherwise.
for(var i in switches.raw) a.push(switches.raw[i]);
} else if (switches[s].indexOf(' ') === -1) {
a.push('-' + s + switches[s]);
} else {
a.push('-' + s + '"' + switches[s] + '"');
Expand Down

0 comments on commit 797d86a

Please sign in to comment.