code: function asyncWrapper(promise){
      return function(...args){
          // extract options (last argument)
          _optionsManager.parse(args.pop())
  
              // trigger command
              .then(options => {
                  // re-merge
                  return promise(...args, options)
              })
  
              // trigger disconnect
              .then(() => {
                  if (_nodemcutool.Connector.isConnected()){
                      _logger.log('disconnecting');
                      return _nodemcutool.disconnect();
                  }
              })
  
              // gracefull exit
              
              .then(() => {
                  process.exit(0)
              })
  
              // handle low-level errors
              .catch(err => {
                  _logger.error(err.message);
                  _logger.debug(err.stack);
                  process.exit(1);
              });
      }
  }
docs: wrap async tasks