Skip to content

Commit

Permalink
Merge pull request gtg092x#3 from iliazubkov/master
Browse files Browse the repository at this point in the history
json format fixed, arg variable
  • Loading branch information
marinabashinskaya authored Feb 16, 2017
2 parents 17b8079 + 32509ff commit 940b406
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/WP.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ WP.discover = function(options,cb){
var required = command.args.filter(function(arg){
return arg.required;
});
if(required.length>args.length)
if(required.length>arg.length)
throw "Error args "+required.map(function(r){return "<"+r.arg+">";}).join(" ")+" are required for "+use.join(" ")+"."+" See http://wp-cli.org/commands/"+use.join('/');

//end check commands
Expand Down
17 changes: 6 additions & 11 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,12 @@ module.exports.wp = function(use,args,flags,cb){
// shelve this for now
cb(e,out);
};



exec("wp "+args.join(" ")+" "+flagArgs,function(err,stdout,stderr){

if(flags.format=="json"&&stdout){
try{
helpIfError(err||stderr,JSON.parse(stdout));
}catch(e){
helpIfError(err||stderr||e,stdout);
}
}else
helpIfError(err||stderr,stdout);
try{
helpIfError(err||stderr,JSON.parse(stdout));
}catch(e){
helpIfError(err||stderr,stdout);
}
});
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-cli",
"version": "0.0.5",
"version": "0.0.7",
"description": "Node Wrapper for Wordpress CLI",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 940b406

Please sign in to comment.