const { exec } = require('child_process');
const EventEmitter = require('events');

class Execute extends EventEmitter {
  constructor() {
    super();
  }

  static run(fullCmd) {
    return new Promise((resolve, reject) => {
      console.log(`Executing command: ${ fullCmd }`);
      exec(fullCmd, (error, stdout, stderr) => {
        if (stderr || error) {
          reject(stderr || error);
        }
        resolve(stdout);
      });
    });
  }

  static cmd(base, params) {
    if (params.constructor !== Array) {
      throw new Error('params must be an Array');
    }
    
    return base + ' ' + params.join(' ');
  }
}

module.exports.Execute = Execute;

@@ -128,16 +128,23 @@
 tructor(
+options
 ) %7B%0A    
@@ -158,37 +158,483 @@
 ;%0A  
-%7D%0A%0A  static run(fullCmd) %7B%0A  
+  let %7B fullCmd, params %7D = options;%0A%0A    this.fullCmd = fullCmd;%0A    this.params = params;%0A  %7D%0A%0A  run() %7B%0A    RunCmd(BuildCmd(this.fullCmd, this.params))%0A      .then((msg) =%3E %7B%0A        this.emit('end', msg);%0A      %7D)%0A      .catch((error) =%3E %7B%0A        this.emit('error', error)%0A      %7D);%0A  %7D%0A%0A  static run(fullCmd) %7B%0A    return RunCmd(fullCmd);%0A  %7D%0A%0A  static cmd(base, params) %7B%0A    return BuildCmd(base, params);%0A  %7D%0A%7D%0A%0Amodule.exports = Execute;%0A%0Afunction RunCmd(fullCmd) %7B%0A
   re
@@ -669,26 +669,24 @@
 eject) =%3E %7B%0A
-  
     console.
@@ -729,18 +729,16 @@
 %60);%0A    
- 
- 
 exec(ful
@@ -778,18 +778,16 @@
 %7B%0A      
-  
 if (stde
@@ -797,26 +797,24 @@
 %7C%7C error) %7B%0A
-  
         reje
@@ -840,22 +840,18 @@
 ;%0A      
-  %7D%0A  
+%7D%0A
       re
@@ -873,37 +873,36 @@
     
-  
 %7D);%0A  
- 
- 
 %7D);%0A
-  
 %7D%0A%0A
-  static c
+function BuildC
 md(b
@@ -918,16 +918,60 @@
 ms) %7B%0A  
+if (!params && base) %7B%0A    return base;%0A  %7D%0A
   if (pa
@@ -996,26 +996,24 @@
 == Array) %7B%0A
-  
     throw ne
@@ -1054,19 +1054,13 @@
 ;%0A  
- 
- 
 %7D%0A  
-  
 %0A
-  
   re
@@ -1099,45 +1099,6 @@
 ');%0A
-  %7D%0A%7D%0A%0Amodule.exports.Execute = Execute;
+%7D
 %0A

Add framework of events system