index.js
function runCommand(command, options) {
    let cmd = getCommand(command);
    if (!cmd || command === 'help') {
      cmd = getCommand('help');
    } else {
      try {
        validateConfig(options);
      } catch (error) {
        console.log(error.message);
        process.exit(1);
      }
    }
    let fn = cmd.callback;
    let opts = mapParams(cmd, options);
    fn(opts).then(function (result) {
      if (cmd.formatter) {
        cmd.formatter.format(result.messages, options);
      } else {
        console.log(result);
      }
    }).catch(function (error) {
      let formatter = new formatters.MessageFormatter();
      if (error.response) {
        console.log(error);
        formatter.format(['Error response received: ' + error.response.data.errors[0].message]);
      } else {

        formatter.format([error.message]);
      }
      process.exit(1);
    });
  }
function runCommand(command, options) {
    let cmd = getCommand(command);
    if (!cmd || command === 'help') {
      cmd = getCommand('help');
    } else {
      try {
        validateConfig(options);
      } catch (error) {
        console.log(error.message);
        process.exit(1);
      }
    }
    let fn = cmd.callback;
    let opts = mapParams(cmd, options);
    fn(opts).then(function (result) {
      if (cmd.formatter) {
        cmd.formatter.format(result.messages, options);
      } else {
        console.log(result);
      }
    }).catch(function (error) {
      let formatter = new formatters.MessageFormatter();
      if (error.response) {
        console.log(error);
        formatter.format(['Error response received: ' + error.response.data.errors[0].message]);
      } else {

        formatter.format([error.message]);
      }
      process.exit(1);
    });
  }
function runCommand ( command , options ) { let cmd = getCommand ( command ) ; if ( ! cmd || command === 'help' ) { cmd = getCommand ( 'help' ) ; } else { try { validateConfig ( options ) ; } catch ( error ) { console . log ( error . message ) ; process . exit ( 1 ) ; } } let fn = cmd . callback ; let opts = mapParams ( cmd , options ) ; fn ( opts ) . then ( function ( result ) { if ( cmd . formatter ) { cmd . formatter . format ( result . messages , options ) ; } else { console . log ( result ) ; } } ) . catch ( function ( error ) { let formatter = new formatters . MessageFormatter ( ) ; if ( error . response ) { console . log ( error ) ; formatter . format ( [ 'Error response received: ' + error . response . data . errors [ 0 ] . message ] ) ; } else { formatter . format ( [ error . message ] ) ; } process . exit ( 1 ) ; } ) ; }
Run the given command and output the result
@param command
@param options
Run the given command and output the result