How to use node-cmd - 10 common examples

To help you get started, we’ve selected a few node-cmd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PortalNetwork / kaizen-cli / build / lib / plugin / add.js View on Github external
function handleNOIA(kaizenConfig) {
  try {
    var checkResult = packageChecker(kaizenConfig);

    if (checkResult.isValid === false) {
      console.error('[ERROR]: please use kaizen new to create new project first');
      return;
    }

    console.log('kaizen: installing noia sdk...'); // clone noia sdk repo and copy out packages

    cmd.get('git clone https://github.com/noia-network/sdk.git temp-noia-sdk', function (error) {
      if (error) {
        handleError(error);
        return;
      }

      ncp('./temp-noia-sdk/packages', './', function (error) {
        if (error) {
          handleError(error);
          return;
        }

        cmd.run('rm -rf ./temp-noia-sdk');
        updateConfig(kaizenConfig, 'NOIA');
      });
    });
  } catch (error) {
github amit-upadhyay-IT / crypt-git / index.js View on Github external
function doPushOperation()
{
    if (commitMessage === '')
        commitMessage = 'Commit via crypt-git';
    var msg = 'git add -A && git commit -m "'+commitMessage+'" && git push -u origin master';
    //var msg = 'git add -A && git commit -m \''+commitMessage+'\' && git push -u origin master';

    if (theReqCmd !== '')// just a normal check if user wants to push or not
    {
        // an async operation because it is required.
        cmd.get(
        msg,
            function(err, data, stderr) {
                if (err)
                {
                    // if the push fails then I need to restore the previous iv otherwise it will give error in decrypting and decompressing
                    console.log(err);
                }
                else
                    console.log(data);
            }
        );
    }
}
github nainemom / nosy-detector / src / index.js View on Github external
console.log(faces, _faces, tryOver)
    }
    if (faces !== _faces) {
      // something new happened
      if (tryOver.length === faces) {
        // this is not first time
        tryOver.times++
        if (tryOver.times > 2) {
          // set trusted total faces
          _faces = faces
          console.log(Date(), `${faces} Face(s) Detected!`)
          if (outputdir.trim() !== 'null') {
            im.save(path.join(absoluteOutputDir, `${Date.now()}-${faces}.jpg`))
          }
          if (faces > availablePersons) {
            runningCmd = cmd.get(command)
          } else if (runningCmd) {
            cmd.get(`kill ${runningCmd.pid + 1}`)
          }
        }
      } else {
        // reset try times
        tryOver.length = faces
        tryOver.times = 0
      }
    }
  })
}
github mosaicdao / mosaic.js / tools / setup / service_manager.js View on Github external
startGeth: function(chain, purpose) {
    const oThis = this
    ;

    // start geth
    logger.info("* Starting " + chain + " chain");
    const cmd = oThis._startGethCommand(chain, purpose);
    logger.info(cmd);
    shellAsyncCmd.run(cmd);
  },
github appleple / SmartPhoto / tools / index.js View on Github external
return new Promise((resolve, reject) => {
    cmd.get(
      cmd_string,
      (data, err, stderr) => {
        if ( err ) {
          console.log(err)
        }
        if ( stderr ) {
          console.log(stderr)
        }
        resolve(data)
      }
    )
  })
}
github TimDurward / xfinity-wifi-hack / index.js View on Github external
setTimeout(function () {
        CMD.get(
            'sudo spoof randomize ' + DRIVER_INTERFACE,
            function (data) {
                macaddress.one(DRIVER_INTERFACE, function (err, mac) {
                    console.log("Generated temporary Mac address for " + DRIVER_INTERFACE + ": %s", mac);
                    var macAdr = mac;
                    callback(null, macAdr);
                });
            }
        );
    }, 15000);
}
github legotheboss / YouTube-files / Fan_accessory.js View on Github external
setSpeed: function(value) {
    console.log("Setting fan rSpeed to %s", value);
    CEILING_FAN.rSpeed = value;
    if (value > 0 && value < 33) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan1.py');
    } else if (value == 0) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan0.py');
    } else if (value > 34 && value < 66) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan2.py');
    } else  if (value > 67 && value < 101) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan3.py');
    }
  },
  identify: function() {
github legotheboss / YouTube-files / Fan_accessory.js View on Github external
setSpeed: function(value) {
    console.log("Setting fan rSpeed to %s", value);
    CEILING_FAN.rSpeed = value;
    if (value > 0 && value < 33) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan1.py');
    } else if (value == 0) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan0.py');
    } else if (value > 34 && value < 66) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan2.py');
    } else  if (value > 67 && value < 101) {
      cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan3.py');
    }
  },
  identify: function() {
github legotheboss / YouTube-files / Garage Solution / Sensorless / Multiple Garages / newGarage.js View on Github external
open: function() {
    console.log("Opening the Garage!");
    cmd.run('sudo python /home/pi/HAP-NodeJS/python/garage2.py');
  },
  close: function() {

node-cmd

Simple commandline/terminal/shell interface to allow you to run cli or bash style commands as if you were in the terminal.

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular node-cmd functions