/*
	Licensed Material - Property of IBM

	(C) Copyright 2015 IBM Corp.

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/


'use strict';

var Q = require('q');
var log = require('npmlog');

/**
 * actually do the work of the command
 */
module.exports.run = function(argv) {
  log.level = global.MDO_CLI_LOG_LEVEL ? global.MDO_CLI_LOG_LEVEL : log.level;

  var deferred = Q.defer();
  var run = require('./push/run.js');
  var runPromise = run(argv);

  runPromise.then(function (rsp) {
    deferred.resolve(rsp);
  }, function (err) {
    deferred.reject(err.code);
  });

  return deferred.promise;
};

/**
 * print command specific help to the console
 */
module.exports.help = function() {
  var path = require('path');
  return path.resolve(__dirname, '..', 'doc', 'push.txt');
};
