├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── index.js ├── lib ├── WP.js ├── commands.js ├── dumps │ └── schema_0.15.0.json ├── gen-app.js ├── overrides.json ├── scrape-commands.js └── utils.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | .project 27 | .idea 28 | cache 29 | test/test.js 30 | test 31 | .DS_Store 32 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | script: 'sudo $(which npm) test' 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Matthew Drake 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [wp-cli](http://wp-cli.org/) [![Build Status](https://travis-ci.org/gtg092x/node-wp-cli.svg?branch=master)](https://travis-ci.org/gtg092x/node-wp-cli) 2 | 3 | > Node Wrapper for Wordpress CLI 4 | 5 | Useful for managing local Wordpress installs via node. All functionality matches the [wp-cli API](http://wp-cli.org/commands/). 6 | 7 | [![NPM](https://nodei.co/npm/wp-cli.png?downloads=true&stars=true)](https://nodei.co/npm/wp-cli/) 8 | 9 | ## Install 10 | 11 | You must install wp-cli for this plugin to work. Please refer to http://wp-cli.org/ for information on getting started. 12 | 13 | ```bash 14 | $ npm install --save wp-cli 15 | ``` 16 | 17 | 18 | ## Usage 19 | 20 | ```js 21 | var WP = require('wp-cli'); 22 | WP.discover({path:'/path/to/install'},function(WP){ 23 | WP.cli.info(function(err,info){ //get CLI info 24 | console.log(info); 25 | }); 26 | WP.comment.list(function(err,comments){ //list comments 27 | console.log(comments); 28 | }); 29 | WP.post.get(1,function(err,comment){ //get post detail 30 | console.log(comment); 31 | }); 32 | WP.core.update(function(err,result){ //updates wordpress install 33 | console.log(result); 34 | }); 35 | }); 36 | ``` 37 | 38 | 39 | ## API 40 | 41 | ### WP.discover(options,callback) 42 | *Alias: `WP.load`* 43 | 44 | Options mirror WP-CLI configuration. Refer to [http://wp-cli.org/config/](http://wp-cli.org/config/) for more information. 45 | 46 | #### options.path 47 | 48 | Type: `String` 49 | Default: `'.'` 50 | 51 | The wordpress install location. 52 | 53 | #### options.url 54 | 55 | Type: `String` 56 | Default: `null` 57 | 58 | Note this is for spoofing a URL, this is not for remote management. If you're interested in remote management, I suggest you push the feature request with the authors of [http://wp-cli.org/](http://wp-cli.org/). 59 | 60 | #### options.user 61 | 62 | Type: `Object or String` 63 | Default: `'null'` 64 | 65 | Pass either a username:password or username|password combination as a String, or an object of the form {username:"name",password:"pass"}. 66 | 67 | #### options.require 68 | 69 | Type: `Array` 70 | Default: `[]` 71 | 72 | Load PHP file(s) before running the command. 73 | 74 | 75 | #### callback 76 | 77 | *Required* 78 | Type: `Function` 79 | 80 | Callback that is passed a WP instance. This instance has config options bound to it if you want to manage more than one wordpress install at a time. 81 | 82 | 83 | ### WP.\ 84 | 85 | The wordpress cli options are pulled from [http://wp-cli.org/commands/cli/cmd-dump/](http://wp-cli.org/commands/cli/cmd-dump/). 86 | 87 | All commands take the form 88 | 89 | ```js 90 | WP.([arguments],[options],callback); 91 | ``` 92 | 93 | Where arguments is an optional argument or array of arguments and options is an optional object of flags and values. 94 | 95 | #### Example 96 | 97 | ```js 98 | var WP = require('wp-cli'); 99 | WP.discover(function(WP){ 100 | WP.scaffold.plugin("my-plugin",{plugin_name:"Hello Node WP"},function(err,result){ // creates a new plugin 101 | console.log(result); 102 | }); 103 | }); 104 | ``` 105 | 106 | Refer to [http://wp-cli.org/commands/](http://wp-cli.org/commands/) for a detailed list of commands and options. 107 | 108 | Most commands work with the exception of commands that are interactive prompts or commands that utilize stdin streams. These commands will be supported in future releases using spawn objects. 109 | 110 | ## License 111 | 112 | [MIT](http://opensource.org/licenses/MIT) -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/WP').WP; -------------------------------------------------------------------------------- /lib/WP.js: -------------------------------------------------------------------------------- 1 | var cli = require('./utils').wp, schema = require('./commands').schema, schemaCache = require('./commands').schemaCache, _ = require('lodash'), util = require('util'); 2 | 3 | var WP = function (options) { 4 | this.options = options || {}; 5 | }; 6 | 7 | var isObject = function (arg) { 8 | return (typeof arg == "object") && (arg !== null); 9 | }; 10 | 11 | var keywords = ["use", "help"]; 12 | 13 | var isKeyword = function (k) { 14 | return !keywords.some(function (kk) { 15 | return kk == k; 16 | }); 17 | }; 18 | 19 | var isFunction = function (func) { 20 | return typeof (func) == 'function'; 21 | } 22 | 23 | WP.discover = function (options, cb) { 24 | if (!cb) { 25 | cb = options; 26 | options = {}; 27 | } 28 | 29 | var verbose = options.verbose === undefined ? false : options.verbose; 30 | delete options.verbose; 31 | 32 | var wp = new WP(_.clone(options)); 33 | 34 | schema(function (err, schema) { 35 | var toMerge = function mapSchema(schema) { 36 | var result = {}; 37 | var keys = Object.keys(schema).filter(isKeyword); 38 | keys.forEach(function (key) { 39 | var command = schema[key]; 40 | if (!command.endpoint) { 41 | if (!isObject(command)) 42 | throw "No object at " + key; 43 | result[key] = mapSchema(command); 44 | } else { 45 | result[key] = function () { 46 | //build WP function 47 | 48 | //normalize args 49 | var args = Array.prototype.slice.call(arguments); 50 | 51 | var use = command.use; 52 | if (!use) 53 | throw "No CLI mapping for " + key; 54 | 55 | var cb = args.pop(); 56 | if (!isFunction(cb)) 57 | throw "No callback supplied"; 58 | 59 | var arg = args[0]; 60 | var options = {}; 61 | if (isObject(arg) && !Array.isArray(arg) && args.length == 1) { 62 | options = arg; 63 | arg = []; 64 | } else { 65 | if (arg) 66 | arg = Array.isArray(arg) ? arg : [arg]; 67 | else 68 | arg = []; 69 | options = args[1] || {}; 70 | } 71 | use = use.replace(/^wp /, "").split(" "); 72 | //end normalize args 73 | 74 | //check commands and supply defaults, setting default format to json 75 | if (command.options && command.options.format && !options.format) 76 | options.format = "json"; 77 | 78 | var schemaOptionKeys = Object.keys(command.options); 79 | schemaOptionKeys.forEach(function (key) { 80 | var schemaOption = command.options[key]; 81 | if (schemaOption.required && key != "field" && !options[key]) {//field is used to represent kwargs in api 82 | throw "Error option <" + key + "> is required for " + use.join(" ") + ". See http://wp-cli.org/commands/" + use.join('/'); 83 | } 84 | }); 85 | 86 | var required = command.args.filter(function (arg) { 87 | return arg.required; 88 | }); 89 | if (required.length > args.length) 90 | throw "Error args " + required.map(function (r) { return "<" + r.arg + ">"; }).join(" ") + " are required for " + use.join(" ") + "." + " See http://wp-cli.org/commands/" + use.join('/'); 91 | 92 | //end check commands 93 | options = _.merge(options, wp.options); 94 | 95 | if (options.user && isObject(options.user)) { 96 | options.user = options.user.username + "|" + options.user.password; 97 | } 98 | if (options.user) 99 | options.user = options.user.replace(":", "|"); 100 | 101 | cli(use, arg, options, cb); 102 | //build WP function 103 | }; 104 | } 105 | }); 106 | return result; 107 | }(schema); 108 | wp = _.merge(wp, toMerge); 109 | cb(wp); 110 | }); 111 | }; 112 | 113 | WP.load = WP.discover; 114 | 115 | module.exports.WP = WP; -------------------------------------------------------------------------------- /lib/commands.js: -------------------------------------------------------------------------------- 1 | var async = require('async'), _ = require('lodash'), fs = require('fs'), exec = require('child_process').exec, cache = null; 2 | 3 | var flagIfRoot = function () { 4 | return (process.getuid && process.getuid() == 0) ? " --allow-root" : "";//can't say I'm encouraging this against the recommendations of the wp-cli authors. 5 | }; 6 | 7 | var schema = function (cb) { 8 | if (cache) return cb(null, cache); 9 | 10 | exec("wp cli info" + flagIfRoot() + " --format=json", function (err, stdout, stderr) { 11 | var info = JSON.parse(stdout); 12 | 13 | exec("wp cli cmd-dump" + flagIfRoot() + "", { 14 | maxBuffer: 1024 * 1024 15 | }, function (err, stdout, stderr) { 16 | var data = JSON.parse(stdout); 17 | 18 | //fs.writeFile(__dirname+"/../cache/dump.json",JSON.stringify(data,false,4),console.log); 19 | 20 | data = function parseCLI(data, parent) { 21 | var result = { args: [], options: {} }; 22 | result.use = (parent.join(" ") + " " + data.name).trim(); 23 | if (data.subcommands && data.subcommands.length) { 24 | for (var i = 0, sub; sub = data.subcommands[i++];) { 25 | result[sub.name.replace("-", "_")] = parseCLI(sub, result.use.split(" ")); 26 | if (sub.name.indexOf('-') != -1) 27 | result[sub.name] = result[sub.name.replace("-", "_")]; 28 | } 29 | } else { 30 | result.endpoint = true; 31 | } 32 | if (data.synopsis) { 33 | var argFlags = data.synopsis.split(" "); 34 | result.args = argFlags.filter(function (arg) { 35 | return !/^\[?--/.test(arg); 36 | }).map(function (arg) { 37 | var required = !/^\[[^\]]+\]$/.test(arg); 38 | arg = arg.replace(/[\[\]<>]/g, ""); 39 | 40 | var type = /...$/.test(arg) ? "args" : "arg"; 41 | 42 | return { required: required, arg: arg.replace(/\.\.\.$/, ""), type: type }; 43 | }); 44 | 45 | var options = argFlags.filter(function (arg) { 46 | return /^\[?--/.test(arg); 47 | }).map(function (arg) { 48 | var required = !/^\[[^\]]+\]$/.test(arg); 49 | arg = arg.replace(/[\[\]<>]/g, "").replace(/^--/, ""); 50 | var type = arg.indexOf("=") == -1 ? "flag" : "param"; 51 | if (type == "flag") 52 | return { arg: arg, required: required, type: type }; 53 | var args = arg.split('='); 54 | return { arg: args[0], required: required, type: type }; 55 | }); 56 | var optionsObject = {}; 57 | options.forEach(function (flag) { 58 | var arg = flag.arg; 59 | delete flag.arg; 60 | optionsObject[arg] = flag; 61 | }); 62 | 63 | result.options = optionsObject; 64 | } 65 | result.help = data.description; 66 | return result; 67 | }(data, []); 68 | 69 | //storing version caches, probably not necessary 70 | //fs.writeFile(__dirname+"/dumps/schema_"+info.wp_cli_version+".json",JSON.stringify(data,false,4)); 71 | cache = data; 72 | cb(null, data); 73 | }); 74 | }); 75 | }; 76 | 77 | module.exports.schema = schema; 78 | 79 | /** 80 | * MDRAKE: could use this for immediate loading, but seems lazy 81 | */ 82 | 83 | var schemaCache = module.exports.schemaCache = function () { 84 | //try to get info from cache synchronously 85 | var schema = null, defaultVersion = "0.15.0"; 86 | try { 87 | schema = JSON.parse(fs.readFileSync(__dirname + "/dumps/schema_" + defaultVersion + ".json", "utf8")); 88 | } catch (e) { 89 | 90 | } 91 | exec("wp cli info --format=json", function (err, stdout, stderr) { 92 | var info = JSON.parse(stdout); 93 | if (info.wp_cli_version != defaultVersion) 94 | console.log("WP CLI warning: your version of wp-cli does not match the default version schema packaged with this plugin. Please use WP.load or set your wp-cli version to " + defaultVersion); 95 | }); 96 | return schema; 97 | } 98 | -------------------------------------------------------------------------------- /lib/dumps/schema_0.15.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "args": [], 3 | "options": {}, 4 | "use": "wp", 5 | "cache": { 6 | "args": [], 7 | "options": {}, 8 | "use": "wp cache", 9 | "add": { 10 | "args": [ 11 | { 12 | "required": true, 13 | "arg": "key", 14 | "type": "args" 15 | }, 16 | { 17 | "required": true, 18 | "arg": "value", 19 | "type": "args" 20 | }, 21 | { 22 | "required": false, 23 | "arg": "group", 24 | "type": "args" 25 | }, 26 | { 27 | "required": false, 28 | "arg": "expiration", 29 | "type": "args" 30 | } 31 | ], 32 | "options": {}, 33 | "use": "wp cache add", 34 | "endpoint": true, 35 | "help": "Add a value to the object cache." 36 | }, 37 | "decr": { 38 | "args": [ 39 | { 40 | "required": true, 41 | "arg": "key", 42 | "type": "args" 43 | }, 44 | { 45 | "required": false, 46 | "arg": "offset", 47 | "type": "args" 48 | }, 49 | { 50 | "required": false, 51 | "arg": "group", 52 | "type": "args" 53 | } 54 | ], 55 | "options": {}, 56 | "use": "wp cache decr", 57 | "endpoint": true, 58 | "help": "Decrement a value in the object cache." 59 | }, 60 | "delete": { 61 | "args": [ 62 | { 63 | "required": true, 64 | "arg": "key", 65 | "type": "args" 66 | }, 67 | { 68 | "required": false, 69 | "arg": "group", 70 | "type": "args" 71 | } 72 | ], 73 | "options": {}, 74 | "use": "wp cache delete", 75 | "endpoint": true, 76 | "help": "Remove a value from the object cache." 77 | }, 78 | "flush": { 79 | "args": [], 80 | "options": {}, 81 | "use": "wp cache flush", 82 | "endpoint": true, 83 | "help": "Flush the object cache." 84 | }, 85 | "get": { 86 | "args": [ 87 | { 88 | "required": true, 89 | "arg": "key", 90 | "type": "args" 91 | }, 92 | { 93 | "required": false, 94 | "arg": "group", 95 | "type": "args" 96 | } 97 | ], 98 | "options": {}, 99 | "use": "wp cache get", 100 | "endpoint": true, 101 | "help": "Get a value from the object cache." 102 | }, 103 | "incr": { 104 | "args": [ 105 | { 106 | "required": true, 107 | "arg": "key", 108 | "type": "args" 109 | }, 110 | { 111 | "required": false, 112 | "arg": "offset", 113 | "type": "args" 114 | }, 115 | { 116 | "required": false, 117 | "arg": "group", 118 | "type": "args" 119 | } 120 | ], 121 | "options": {}, 122 | "use": "wp cache incr", 123 | "endpoint": true, 124 | "help": "Increment a value in the object cache." 125 | }, 126 | "replace": { 127 | "args": [ 128 | { 129 | "required": true, 130 | "arg": "key", 131 | "type": "args" 132 | }, 133 | { 134 | "required": true, 135 | "arg": "value", 136 | "type": "args" 137 | }, 138 | { 139 | "required": false, 140 | "arg": "group", 141 | "type": "args" 142 | }, 143 | { 144 | "required": false, 145 | "arg": "expiration", 146 | "type": "args" 147 | } 148 | ], 149 | "options": {}, 150 | "use": "wp cache replace", 151 | "endpoint": true, 152 | "help": "Replace an existing value in the object cache." 153 | }, 154 | "set": { 155 | "args": [ 156 | { 157 | "required": true, 158 | "arg": "key", 159 | "type": "args" 160 | }, 161 | { 162 | "required": true, 163 | "arg": "value", 164 | "type": "args" 165 | }, 166 | { 167 | "required": false, 168 | "arg": "group", 169 | "type": "args" 170 | }, 171 | { 172 | "required": false, 173 | "arg": "expiration", 174 | "type": "args" 175 | } 176 | ], 177 | "options": {}, 178 | "use": "wp cache set", 179 | "endpoint": true, 180 | "help": "Set a value to the object cache." 181 | }, 182 | "type": { 183 | "args": [], 184 | "options": {}, 185 | "use": "wp cache type", 186 | "endpoint": true, 187 | "help": "Attempts to determine which object cache is being used." 188 | }, 189 | "help": "Manage the object cache." 190 | }, 191 | "cap": { 192 | "args": [], 193 | "options": {}, 194 | "use": "wp cap", 195 | "add": { 196 | "args": [ 197 | { 198 | "required": true, 199 | "arg": "role", 200 | "type": "args" 201 | }, 202 | { 203 | "required": true, 204 | "arg": "cap", 205 | "type": "args" 206 | } 207 | ], 208 | "options": {}, 209 | "use": "wp cap add", 210 | "endpoint": true, 211 | "help": "Add capabilities to a given role." 212 | }, 213 | "list": { 214 | "args": [ 215 | { 216 | "required": true, 217 | "arg": "role", 218 | "type": "args" 219 | } 220 | ], 221 | "options": {}, 222 | "use": "wp cap list", 223 | "endpoint": true, 224 | "help": "List capabilities for a given role." 225 | }, 226 | "remove": { 227 | "args": [ 228 | { 229 | "required": true, 230 | "arg": "role", 231 | "type": "args" 232 | }, 233 | { 234 | "required": true, 235 | "arg": "cap", 236 | "type": "args" 237 | } 238 | ], 239 | "options": {}, 240 | "use": "wp cap remove", 241 | "endpoint": true, 242 | "help": "Remove capabilities from a given role." 243 | }, 244 | "help": "Manage user capabilities." 245 | }, 246 | "cli": { 247 | "args": [], 248 | "options": {}, 249 | "use": "wp cli", 250 | "cmd_dump": { 251 | "args": [], 252 | "options": {}, 253 | "use": "wp cli cmd-dump", 254 | "endpoint": true, 255 | "help": "Dump the list of installed commands, as JSON." 256 | }, 257 | "completions": { 258 | "args": [], 259 | "options": { 260 | "line": { 261 | "required": true, 262 | "type": "param" 263 | }, 264 | "point": { 265 | "required": true, 266 | "type": "param" 267 | } 268 | }, 269 | "use": "wp cli completions", 270 | "endpoint": true, 271 | "help": "Generate tab completion strings." 272 | }, 273 | "info": { 274 | "args": [], 275 | "options": { 276 | "format": { 277 | "required": false, 278 | "type": "param" 279 | } 280 | }, 281 | "use": "wp cli info", 282 | "endpoint": true, 283 | "help": "Print various data about the CLI environment." 284 | }, 285 | "param_dump": { 286 | "args": [], 287 | "options": {}, 288 | "use": "wp cli param-dump", 289 | "endpoint": true, 290 | "help": "Dump the list of global parameters, as JSON." 291 | }, 292 | "version": { 293 | "args": [], 294 | "options": {}, 295 | "use": "wp cli version", 296 | "endpoint": true, 297 | "help": "Print WP-CLI version." 298 | }, 299 | "help": "Get information about WP-CLI itself." 300 | }, 301 | "comment": { 302 | "args": [], 303 | "options": {}, 304 | "use": "wp comment", 305 | "approve": { 306 | "args": [ 307 | { 308 | "required": true, 309 | "arg": "id", 310 | "type": "arg" 311 | } 312 | ], 313 | "options": {}, 314 | "use": "wp comment approve", 315 | "endpoint": true, 316 | "help": "Approve a comment." 317 | }, 318 | "count": { 319 | "args": [ 320 | { 321 | "required": false, 322 | "arg": "post-id", 323 | "type": "args" 324 | } 325 | ], 326 | "options": {}, 327 | "use": "wp comment count", 328 | "endpoint": true, 329 | "help": "Count comments, on whole blog or on a given post." 330 | }, 331 | "create": { 332 | "args": [], 333 | "options": { 334 | "field": { 335 | "required": true, 336 | "type": "param" 337 | }, 338 | "porcelain": { 339 | "required": false, 340 | "type": "flag" 341 | } 342 | }, 343 | "use": "wp comment create", 344 | "endpoint": true, 345 | "help": "Insert a comment." 346 | }, 347 | "delete": { 348 | "args": [ 349 | { 350 | "required": true, 351 | "arg": "id", 352 | "type": "args" 353 | } 354 | ], 355 | "options": { 356 | "force": { 357 | "required": false, 358 | "type": "flag" 359 | } 360 | }, 361 | "use": "wp comment delete", 362 | "endpoint": true, 363 | "help": "Delete a comment." 364 | }, 365 | "exists": { 366 | "args": [ 367 | { 368 | "required": true, 369 | "arg": "id", 370 | "type": "arg" 371 | } 372 | ], 373 | "options": {}, 374 | "use": "wp comment exists", 375 | "endpoint": true, 376 | "help": "Verify whether a comment exists." 377 | }, 378 | "get": { 379 | "args": [ 380 | { 381 | "required": true, 382 | "arg": "id", 383 | "type": "arg" 384 | } 385 | ], 386 | "options": { 387 | "field": { 388 | "required": false, 389 | "type": "param" 390 | }, 391 | "format": { 392 | "required": false, 393 | "type": "param" 394 | } 395 | }, 396 | "use": "wp comment get", 397 | "endpoint": true, 398 | "help": "Get a single comment." 399 | }, 400 | "list": { 401 | "args": [], 402 | "options": { 403 | "field": { 404 | "required": false, 405 | "type": "param" 406 | }, 407 | "fields": { 408 | "required": false, 409 | "type": "param" 410 | }, 411 | "format": { 412 | "required": false, 413 | "type": "param" 414 | } 415 | }, 416 | "use": "wp comment list", 417 | "endpoint": true, 418 | "help": "Get a list of comments." 419 | }, 420 | "meta": { 421 | "args": [], 422 | "options": {}, 423 | "use": "wp comment meta", 424 | "add": { 425 | "args": [ 426 | { 427 | "required": true, 428 | "arg": "id", 429 | "type": "arg" 430 | }, 431 | { 432 | "required": true, 433 | "arg": "key", 434 | "type": "args" 435 | }, 436 | { 437 | "required": false, 438 | "arg": "value", 439 | "type": "args" 440 | } 441 | ], 442 | "options": { 443 | "format": { 444 | "required": false, 445 | "type": "param" 446 | } 447 | }, 448 | "use": "wp comment meta add", 449 | "endpoint": true, 450 | "help": "Add a meta field." 451 | }, 452 | "delete": { 453 | "args": [ 454 | { 455 | "required": true, 456 | "arg": "id", 457 | "type": "arg" 458 | }, 459 | { 460 | "required": true, 461 | "arg": "key", 462 | "type": "args" 463 | } 464 | ], 465 | "options": {}, 466 | "use": "wp comment meta delete", 467 | "endpoint": true, 468 | "help": "Delete a meta field." 469 | }, 470 | "get": { 471 | "args": [ 472 | { 473 | "required": true, 474 | "arg": "id", 475 | "type": "arg" 476 | }, 477 | { 478 | "required": true, 479 | "arg": "key", 480 | "type": "args" 481 | } 482 | ], 483 | "options": { 484 | "format": { 485 | "required": false, 486 | "type": "param" 487 | } 488 | }, 489 | "use": "wp comment meta get", 490 | "endpoint": true, 491 | "help": "Get meta field value." 492 | }, 493 | "update": { 494 | "args": [ 495 | { 496 | "required": true, 497 | "arg": "id", 498 | "type": "arg" 499 | }, 500 | { 501 | "required": true, 502 | "arg": "key", 503 | "type": "args" 504 | }, 505 | { 506 | "required": false, 507 | "arg": "value", 508 | "type": "args" 509 | } 510 | ], 511 | "options": { 512 | "format": { 513 | "required": false, 514 | "type": "param" 515 | } 516 | }, 517 | "use": "wp comment meta update", 518 | "endpoint": true, 519 | "help": "Update a meta field." 520 | }, 521 | "help": "Manage comment custom fields." 522 | }, 523 | "spam": { 524 | "args": [ 525 | { 526 | "required": true, 527 | "arg": "id", 528 | "type": "arg" 529 | } 530 | ], 531 | "options": {}, 532 | "use": "wp comment spam", 533 | "endpoint": true, 534 | "help": "Spam a comment." 535 | }, 536 | "status": { 537 | "args": [ 538 | { 539 | "required": true, 540 | "arg": "id", 541 | "type": "arg" 542 | } 543 | ], 544 | "options": {}, 545 | "use": "wp comment status", 546 | "endpoint": true, 547 | "help": "Get status of a comment." 548 | }, 549 | "trash": { 550 | "args": [ 551 | { 552 | "required": true, 553 | "arg": "id", 554 | "type": "arg" 555 | } 556 | ], 557 | "options": {}, 558 | "use": "wp comment trash", 559 | "endpoint": true, 560 | "help": "Trash a comment." 561 | }, 562 | "unapprove": { 563 | "args": [ 564 | { 565 | "required": true, 566 | "arg": "id", 567 | "type": "arg" 568 | } 569 | ], 570 | "options": {}, 571 | "use": "wp comment unapprove", 572 | "endpoint": true, 573 | "help": "Unapprove a comment." 574 | }, 575 | "unspam": { 576 | "args": [ 577 | { 578 | "required": true, 579 | "arg": "id", 580 | "type": "arg" 581 | } 582 | ], 583 | "options": {}, 584 | "use": "wp comment unspam", 585 | "endpoint": true, 586 | "help": "Unspam a comment." 587 | }, 588 | "untrash": { 589 | "args": [ 590 | { 591 | "required": true, 592 | "arg": "id", 593 | "type": "arg" 594 | } 595 | ], 596 | "options": {}, 597 | "use": "wp comment untrash", 598 | "endpoint": true, 599 | "help": "Untrash a comment." 600 | }, 601 | "update": { 602 | "args": [ 603 | { 604 | "required": true, 605 | "arg": "id", 606 | "type": "args" 607 | } 608 | ], 609 | "options": { 610 | "field": { 611 | "required": true, 612 | "type": "param" 613 | } 614 | }, 615 | "use": "wp comment update", 616 | "endpoint": true, 617 | "help": "Update one or more comments." 618 | }, 619 | "url": { 620 | "args": [ 621 | { 622 | "required": true, 623 | "arg": "id", 624 | "type": "args" 625 | } 626 | ], 627 | "options": {}, 628 | "use": "wp comment url", 629 | "endpoint": true, 630 | "help": "Get comment url" 631 | }, 632 | "help": "Manage comments." 633 | }, 634 | "core": { 635 | "args": [], 636 | "options": {}, 637 | "use": "wp core", 638 | "config": { 639 | "args": [], 640 | "options": { 641 | "dbname": { 642 | "required": true, 643 | "type": "param" 644 | }, 645 | "dbuser": { 646 | "required": true, 647 | "type": "param" 648 | }, 649 | "dbpass": { 650 | "required": false, 651 | "type": "param" 652 | }, 653 | "dbhost": { 654 | "required": false, 655 | "type": "param" 656 | }, 657 | "dbprefix": { 658 | "required": false, 659 | "type": "param" 660 | }, 661 | "dbcharset": { 662 | "required": false, 663 | "type": "param" 664 | }, 665 | "dbcollate": { 666 | "required": false, 667 | "type": "param" 668 | }, 669 | "locale": { 670 | "required": false, 671 | "type": "param" 672 | }, 673 | "extra-php": { 674 | "required": false, 675 | "type": "flag" 676 | }, 677 | "skip-salts": { 678 | "required": false, 679 | "type": "flag" 680 | }, 681 | "skip-check": { 682 | "required": false, 683 | "type": "flag" 684 | } 685 | }, 686 | "use": "wp core config", 687 | "endpoint": true, 688 | "help": "Generate a wp-config.php file." 689 | }, 690 | "download": { 691 | "args": [], 692 | "options": { 693 | "path": { 694 | "required": false, 695 | "type": "param" 696 | }, 697 | "locale": { 698 | "required": false, 699 | "type": "param" 700 | }, 701 | "version": { 702 | "required": false, 703 | "type": "param" 704 | }, 705 | "force": { 706 | "required": false, 707 | "type": "flag" 708 | } 709 | }, 710 | "use": "wp core download", 711 | "endpoint": true, 712 | "help": "Download core WordPress files." 713 | }, 714 | "install": { 715 | "args": [], 716 | "options": { 717 | "url": { 718 | "required": true, 719 | "type": "param" 720 | }, 721 | "title": { 722 | "required": true, 723 | "type": "param" 724 | }, 725 | "admin_user": { 726 | "required": true, 727 | "type": "param" 728 | }, 729 | "admin_password": { 730 | "required": true, 731 | "type": "param" 732 | }, 733 | "admin_email": { 734 | "required": true, 735 | "type": "param" 736 | } 737 | }, 738 | "use": "wp core install", 739 | "endpoint": true, 740 | "help": "Create the WordPress tables in the database." 741 | }, 742 | "is_installed": { 743 | "args": [], 744 | "options": { 745 | "network": { 746 | "required": false, 747 | "type": "flag" 748 | } 749 | }, 750 | "use": "wp core is-installed", 751 | "endpoint": true, 752 | "help": "Determine if the WordPress tables are installed." 753 | }, 754 | "multisite_convert": { 755 | "args": [], 756 | "options": { 757 | "title": { 758 | "required": false, 759 | "type": "param" 760 | }, 761 | "base": { 762 | "required": false, 763 | "type": "param" 764 | }, 765 | "subdomains": { 766 | "required": false, 767 | "type": "flag" 768 | } 769 | }, 770 | "use": "wp core multisite-convert", 771 | "endpoint": true, 772 | "help": "Transform a single-site install into a multi-site install." 773 | }, 774 | "multisite_install": { 775 | "args": [], 776 | "options": { 777 | "url": { 778 | "required": false, 779 | "type": "param" 780 | }, 781 | "base": { 782 | "required": false, 783 | "type": "param" 784 | }, 785 | "subdomains": { 786 | "required": false, 787 | "type": "flag" 788 | }, 789 | "title": { 790 | "required": true, 791 | "type": "param" 792 | }, 793 | "admin_user": { 794 | "required": true, 795 | "type": "param" 796 | }, 797 | "admin_password": { 798 | "required": true, 799 | "type": "param" 800 | }, 801 | "admin_email": { 802 | "required": true, 803 | "type": "param" 804 | } 805 | }, 806 | "use": "wp core multisite-install", 807 | "endpoint": true, 808 | "help": "Install multisite from scratch." 809 | }, 810 | "update": { 811 | "args": [ 812 | { 813 | "required": false, 814 | "arg": "zip", 815 | "type": "args" 816 | } 817 | ], 818 | "options": { 819 | "version": { 820 | "required": false, 821 | "type": "param" 822 | }, 823 | "force": { 824 | "required": false, 825 | "type": "flag" 826 | }, 827 | "locale": { 828 | "required": false, 829 | "type": "param" 830 | } 831 | }, 832 | "use": "wp core update", 833 | "endpoint": true, 834 | "help": "Update WordPress." 835 | }, 836 | "update_db": { 837 | "args": [], 838 | "options": {}, 839 | "use": "wp core update-db", 840 | "endpoint": true, 841 | "help": "Update the WordPress database." 842 | }, 843 | "version": { 844 | "args": [], 845 | "options": { 846 | "extra": { 847 | "required": false, 848 | "type": "flag" 849 | } 850 | }, 851 | "use": "wp core version", 852 | "endpoint": true, 853 | "help": "Display the WordPress version." 854 | }, 855 | "help": "Download, install, update and otherwise manage WordPress proper." 856 | }, 857 | "db": { 858 | "args": [], 859 | "options": {}, 860 | "use": "wp db", 861 | "cli": { 862 | "args": [], 863 | "options": {}, 864 | "use": "wp db cli", 865 | "endpoint": true, 866 | "help": "Open a mysql console using the WordPress credentials." 867 | }, 868 | "create": { 869 | "args": [], 870 | "options": {}, 871 | "use": "wp db create", 872 | "endpoint": true, 873 | "help": "Create the database, as specified in wp-config.php" 874 | }, 875 | "drop": { 876 | "args": [], 877 | "options": { 878 | "yes": { 879 | "required": false, 880 | "type": "flag" 881 | } 882 | }, 883 | "use": "wp db drop", 884 | "endpoint": true, 885 | "help": "Delete the database." 886 | }, 887 | "export": { 888 | "args": [ 889 | { 890 | "required": false, 891 | "arg": "file", 892 | "type": "args" 893 | } 894 | ], 895 | "options": { 896 | "field": { 897 | "required": false, 898 | "type": "param" 899 | }, 900 | "tables": { 901 | "required": false, 902 | "type": "param" 903 | } 904 | }, 905 | "use": "wp db export", 906 | "endpoint": true, 907 | "help": "Exports the database to a file or to STDOUT." 908 | }, 909 | "import": { 910 | "args": [ 911 | { 912 | "required": false, 913 | "arg": "file", 914 | "type": "args" 915 | } 916 | ], 917 | "options": {}, 918 | "use": "wp db import", 919 | "endpoint": true, 920 | "help": "Import database from a file or from STDIN." 921 | }, 922 | "optimize": { 923 | "args": [], 924 | "options": {}, 925 | "use": "wp db optimize", 926 | "endpoint": true, 927 | "help": "Optimize the database." 928 | }, 929 | "query": { 930 | "args": [ 931 | { 932 | "required": false, 933 | "arg": "sql", 934 | "type": "args" 935 | } 936 | ], 937 | "options": {}, 938 | "use": "wp db query", 939 | "endpoint": true, 940 | "help": "Execute a query against the database." 941 | }, 942 | "repair": { 943 | "args": [], 944 | "options": {}, 945 | "use": "wp db repair", 946 | "endpoint": true, 947 | "help": "Repair the database." 948 | }, 949 | "reset": { 950 | "args": [], 951 | "options": { 952 | "yes": { 953 | "required": false, 954 | "type": "flag" 955 | } 956 | }, 957 | "use": "wp db reset", 958 | "endpoint": true, 959 | "help": "Remove all tables from the database." 960 | }, 961 | "tables": { 962 | "args": [], 963 | "options": { 964 | "scope": { 965 | "required": false, 966 | "type": "param" 967 | } 968 | }, 969 | "use": "wp db tables", 970 | "endpoint": true, 971 | "help": "List the database tables." 972 | }, 973 | "help": "Perform basic database operations." 974 | }, 975 | "eval": { 976 | "args": [ 977 | { 978 | "required": true, 979 | "arg": "php-code", 980 | "type": "args" 981 | } 982 | ], 983 | "options": {}, 984 | "use": "wp eval", 985 | "endpoint": true, 986 | "help": "Execute arbitrary PHP code after loading WordPress." 987 | }, 988 | "eval_file": { 989 | "args": [ 990 | { 991 | "required": true, 992 | "arg": "file", 993 | "type": "args" 994 | }, 995 | { 996 | "required": false, 997 | "arg": "arg", 998 | "type": "args" 999 | } 1000 | ], 1001 | "options": {}, 1002 | "use": "wp eval-file", 1003 | "endpoint": true, 1004 | "help": "Load and execute a PHP file after loading WordPress." 1005 | }, 1006 | "export": { 1007 | "args": [], 1008 | "options": { 1009 | "dir": { 1010 | "required": false, 1011 | "type": "param" 1012 | }, 1013 | "skip_comments": { 1014 | "required": false, 1015 | "type": "flag" 1016 | }, 1017 | "max_file_size": { 1018 | "required": false, 1019 | "type": "param" 1020 | }, 1021 | "start_date": { 1022 | "required": false, 1023 | "type": "param" 1024 | }, 1025 | "end_date": { 1026 | "required": false, 1027 | "type": "param" 1028 | }, 1029 | "post_type": { 1030 | "required": false, 1031 | "type": "param" 1032 | }, 1033 | "post__in": { 1034 | "required": false, 1035 | "type": "param" 1036 | }, 1037 | "author": { 1038 | "required": false, 1039 | "type": "param" 1040 | }, 1041 | "category": { 1042 | "required": false, 1043 | "type": "param" 1044 | }, 1045 | "post_status": { 1046 | "required": false, 1047 | "type": "param" 1048 | } 1049 | }, 1050 | "use": "wp export", 1051 | "endpoint": true, 1052 | "help": "Export content to a WXR file." 1053 | }, 1054 | "help": "Manage WordPress through the command-line.", 1055 | "import": { 1056 | "args": [ 1057 | { 1058 | "required": true, 1059 | "arg": "file", 1060 | "type": "args" 1061 | } 1062 | ], 1063 | "options": { 1064 | "authors": { 1065 | "required": true, 1066 | "type": "param" 1067 | }, 1068 | "skip": { 1069 | "required": false, 1070 | "type": "param" 1071 | } 1072 | }, 1073 | "use": "wp import", 1074 | "endpoint": true, 1075 | "help": "Import content from a WXR file." 1076 | }, 1077 | "media": { 1078 | "args": [], 1079 | "options": {}, 1080 | "use": "wp media", 1081 | "import": { 1082 | "args": [ 1083 | { 1084 | "required": true, 1085 | "arg": "file", 1086 | "type": "args" 1087 | } 1088 | ], 1089 | "options": { 1090 | "post_id": { 1091 | "required": false, 1092 | "type": "param" 1093 | }, 1094 | "title": { 1095 | "required": false, 1096 | "type": "param" 1097 | }, 1098 | "caption": { 1099 | "required": false, 1100 | "type": "param" 1101 | }, 1102 | "alt": { 1103 | "required": false, 1104 | "type": "param" 1105 | }, 1106 | "desc": { 1107 | "required": false, 1108 | "type": "param" 1109 | }, 1110 | "featured_image": { 1111 | "required": false, 1112 | "type": "flag" 1113 | } 1114 | }, 1115 | "use": "wp media import", 1116 | "endpoint": true, 1117 | "help": "Create attachments from local files or from URLs." 1118 | }, 1119 | "regenerate": { 1120 | "args": [ 1121 | { 1122 | "required": false, 1123 | "arg": "attachment-id", 1124 | "type": "args" 1125 | } 1126 | ], 1127 | "options": { 1128 | "yes": { 1129 | "required": false, 1130 | "type": "flag" 1131 | } 1132 | }, 1133 | "use": "wp media regenerate", 1134 | "endpoint": true, 1135 | "help": "Regenerate thumbnail(s)." 1136 | }, 1137 | "help": "Manage attachments." 1138 | }, 1139 | "menu": { 1140 | "args": [], 1141 | "options": {}, 1142 | "use": "wp menu", 1143 | "create": { 1144 | "args": [ 1145 | { 1146 | "required": true, 1147 | "arg": "menu-name", 1148 | "type": "args" 1149 | } 1150 | ], 1151 | "options": { 1152 | "porcelain": { 1153 | "required": false, 1154 | "type": "flag" 1155 | } 1156 | }, 1157 | "use": "wp menu create", 1158 | "endpoint": true, 1159 | "help": "Create a new menu" 1160 | }, 1161 | "delete": { 1162 | "args": [ 1163 | { 1164 | "required": true, 1165 | "arg": "menu", 1166 | "type": "args" 1167 | } 1168 | ], 1169 | "options": {}, 1170 | "use": "wp menu delete", 1171 | "endpoint": true, 1172 | "help": "Delete one or more menus" 1173 | }, 1174 | "item": { 1175 | "args": [], 1176 | "options": {}, 1177 | "use": "wp menu item", 1178 | "add_custom": { 1179 | "args": [ 1180 | { 1181 | "required": true, 1182 | "arg": "menu", 1183 | "type": "args" 1184 | }, 1185 | { 1186 | "required": true, 1187 | "arg": "title", 1188 | "type": "args" 1189 | }, 1190 | { 1191 | "required": true, 1192 | "arg": "link", 1193 | "type": "args" 1194 | } 1195 | ], 1196 | "options": { 1197 | "description": { 1198 | "required": false, 1199 | "type": "param" 1200 | }, 1201 | "attr-title": { 1202 | "required": false, 1203 | "type": "param" 1204 | }, 1205 | "target": { 1206 | "required": false, 1207 | "type": "param" 1208 | }, 1209 | "classes": { 1210 | "required": false, 1211 | "type": "param" 1212 | }, 1213 | "position": { 1214 | "required": false, 1215 | "type": "param" 1216 | }, 1217 | "parent-id": { 1218 | "required": false, 1219 | "type": "param" 1220 | }, 1221 | "porcelain": { 1222 | "required": false, 1223 | "type": "flag" 1224 | } 1225 | }, 1226 | "use": "wp menu item add-custom", 1227 | "endpoint": true, 1228 | "help": "Add a custom menu item" 1229 | }, 1230 | "add_post": { 1231 | "args": [ 1232 | { 1233 | "required": true, 1234 | "arg": "menu", 1235 | "type": "args" 1236 | }, 1237 | { 1238 | "required": true, 1239 | "arg": "post-id", 1240 | "type": "args" 1241 | } 1242 | ], 1243 | "options": { 1244 | "title": { 1245 | "required": false, 1246 | "type": "param" 1247 | }, 1248 | "link": { 1249 | "required": false, 1250 | "type": "param" 1251 | }, 1252 | "description": { 1253 | "required": false, 1254 | "type": "param" 1255 | }, 1256 | "attr-title": { 1257 | "required": false, 1258 | "type": "param" 1259 | }, 1260 | "target": { 1261 | "required": false, 1262 | "type": "param" 1263 | }, 1264 | "classes": { 1265 | "required": false, 1266 | "type": "param" 1267 | }, 1268 | "position": { 1269 | "required": false, 1270 | "type": "param" 1271 | }, 1272 | "parent-id": { 1273 | "required": false, 1274 | "type": "param" 1275 | }, 1276 | "porcelain": { 1277 | "required": false, 1278 | "type": "flag" 1279 | } 1280 | }, 1281 | "use": "wp menu item add-post", 1282 | "endpoint": true, 1283 | "help": "Add a post as a menu item" 1284 | }, 1285 | "add_term": { 1286 | "args": [ 1287 | { 1288 | "required": true, 1289 | "arg": "menu", 1290 | "type": "args" 1291 | }, 1292 | { 1293 | "required": true, 1294 | "arg": "taxonomy", 1295 | "type": "args" 1296 | }, 1297 | { 1298 | "required": true, 1299 | "arg": "term-id", 1300 | "type": "args" 1301 | } 1302 | ], 1303 | "options": { 1304 | "title": { 1305 | "required": false, 1306 | "type": "param" 1307 | }, 1308 | "link": { 1309 | "required": false, 1310 | "type": "param" 1311 | }, 1312 | "description": { 1313 | "required": false, 1314 | "type": "param" 1315 | }, 1316 | "attr-title": { 1317 | "required": false, 1318 | "type": "param" 1319 | }, 1320 | "target": { 1321 | "required": false, 1322 | "type": "param" 1323 | }, 1324 | "classes": { 1325 | "required": false, 1326 | "type": "param" 1327 | }, 1328 | "position": { 1329 | "required": false, 1330 | "type": "param" 1331 | }, 1332 | "parent-id": { 1333 | "required": false, 1334 | "type": "param" 1335 | }, 1336 | "porcelain": { 1337 | "required": false, 1338 | "type": "flag" 1339 | } 1340 | }, 1341 | "use": "wp menu item add-term", 1342 | "endpoint": true, 1343 | "help": "Add a taxonomy term as a menu item" 1344 | }, 1345 | "delete": { 1346 | "args": [ 1347 | { 1348 | "required": true, 1349 | "arg": "db-id", 1350 | "type": "args" 1351 | } 1352 | ], 1353 | "options": {}, 1354 | "use": "wp menu item delete", 1355 | "endpoint": true, 1356 | "help": "Delete one or more items from a menu" 1357 | }, 1358 | "list": { 1359 | "args": [ 1360 | { 1361 | "required": true, 1362 | "arg": "menu", 1363 | "type": "args" 1364 | } 1365 | ], 1366 | "options": { 1367 | "fields": { 1368 | "required": false, 1369 | "type": "param" 1370 | }, 1371 | "format": { 1372 | "required": false, 1373 | "type": "param" 1374 | } 1375 | }, 1376 | "use": "wp menu item list", 1377 | "endpoint": true, 1378 | "help": "Get a list of items associated with a menu" 1379 | }, 1380 | "update": { 1381 | "args": [ 1382 | { 1383 | "required": true, 1384 | "arg": "db-id", 1385 | "type": "args" 1386 | } 1387 | ], 1388 | "options": { 1389 | "title": { 1390 | "required": false, 1391 | "type": "param" 1392 | }, 1393 | "link": { 1394 | "required": false, 1395 | "type": "param" 1396 | }, 1397 | "description": { 1398 | "required": false, 1399 | "type": "param" 1400 | }, 1401 | "attr-title": { 1402 | "required": false, 1403 | "type": "param" 1404 | }, 1405 | "target": { 1406 | "required": false, 1407 | "type": "param" 1408 | }, 1409 | "classes": { 1410 | "required": false, 1411 | "type": "param" 1412 | }, 1413 | "position": { 1414 | "required": false, 1415 | "type": "param" 1416 | }, 1417 | "parent-id": { 1418 | "required": false, 1419 | "type": "param" 1420 | } 1421 | }, 1422 | "use": "wp menu item update", 1423 | "endpoint": true, 1424 | "help": "Update a menu item" 1425 | }, 1426 | "help": "List, add, and delete items associated with a menu" 1427 | }, 1428 | "list": { 1429 | "args": [], 1430 | "options": { 1431 | "fields": { 1432 | "required": false, 1433 | "type": "param" 1434 | }, 1435 | "format": { 1436 | "required": false, 1437 | "type": "param" 1438 | } 1439 | }, 1440 | "use": "wp menu list", 1441 | "endpoint": true, 1442 | "help": "Get a list of menus." 1443 | }, 1444 | "location": { 1445 | "args": [], 1446 | "options": {}, 1447 | "use": "wp menu location", 1448 | "assign": { 1449 | "args": [ 1450 | { 1451 | "required": true, 1452 | "arg": "menu", 1453 | "type": "args" 1454 | }, 1455 | { 1456 | "required": true, 1457 | "arg": "location", 1458 | "type": "args" 1459 | } 1460 | ], 1461 | "options": {}, 1462 | "use": "wp menu location assign", 1463 | "endpoint": true, 1464 | "help": "Assign a location to a menu" 1465 | }, 1466 | "list": { 1467 | "args": [], 1468 | "options": { 1469 | "format": { 1470 | "required": false, 1471 | "type": "param" 1472 | } 1473 | }, 1474 | "use": "wp menu location list", 1475 | "endpoint": true, 1476 | "help": "List locations for the current theme." 1477 | }, 1478 | "remove": { 1479 | "args": [ 1480 | { 1481 | "required": true, 1482 | "arg": "menu", 1483 | "type": "args" 1484 | }, 1485 | { 1486 | "required": true, 1487 | "arg": "location", 1488 | "type": "args" 1489 | } 1490 | ], 1491 | "options": {}, 1492 | "use": "wp menu location remove", 1493 | "endpoint": true, 1494 | "help": "Remove a location from a menu" 1495 | }, 1496 | "help": "Manage a menu's assignment to locations." 1497 | }, 1498 | "help": "List, create, assign, and delete menus" 1499 | }, 1500 | "network": { 1501 | "args": [], 1502 | "options": {}, 1503 | "use": "wp network", 1504 | "meta": { 1505 | "args": [], 1506 | "options": {}, 1507 | "use": "wp network meta", 1508 | "add": { 1509 | "args": [ 1510 | { 1511 | "required": true, 1512 | "arg": "id", 1513 | "type": "arg" 1514 | }, 1515 | { 1516 | "required": true, 1517 | "arg": "key", 1518 | "type": "args" 1519 | }, 1520 | { 1521 | "required": false, 1522 | "arg": "value", 1523 | "type": "args" 1524 | } 1525 | ], 1526 | "options": { 1527 | "format": { 1528 | "required": false, 1529 | "type": "param" 1530 | } 1531 | }, 1532 | "use": "wp network meta add", 1533 | "endpoint": true, 1534 | "help": "Add a meta field." 1535 | }, 1536 | "delete": { 1537 | "args": [ 1538 | { 1539 | "required": true, 1540 | "arg": "id", 1541 | "type": "arg" 1542 | }, 1543 | { 1544 | "required": true, 1545 | "arg": "key", 1546 | "type": "args" 1547 | } 1548 | ], 1549 | "options": {}, 1550 | "use": "wp network meta delete", 1551 | "endpoint": true, 1552 | "help": "Delete a meta field." 1553 | }, 1554 | "get": { 1555 | "args": [ 1556 | { 1557 | "required": true, 1558 | "arg": "id", 1559 | "type": "arg" 1560 | }, 1561 | { 1562 | "required": true, 1563 | "arg": "key", 1564 | "type": "args" 1565 | } 1566 | ], 1567 | "options": { 1568 | "format": { 1569 | "required": false, 1570 | "type": "param" 1571 | } 1572 | }, 1573 | "use": "wp network meta get", 1574 | "endpoint": true, 1575 | "help": "Get meta field value." 1576 | }, 1577 | "update": { 1578 | "args": [ 1579 | { 1580 | "required": true, 1581 | "arg": "id", 1582 | "type": "arg" 1583 | }, 1584 | { 1585 | "required": true, 1586 | "arg": "key", 1587 | "type": "args" 1588 | }, 1589 | { 1590 | "required": false, 1591 | "arg": "value", 1592 | "type": "args" 1593 | } 1594 | ], 1595 | "options": { 1596 | "format": { 1597 | "required": false, 1598 | "type": "param" 1599 | } 1600 | }, 1601 | "use": "wp network meta update", 1602 | "endpoint": true, 1603 | "help": "Update a meta field." 1604 | }, 1605 | "help": "Manage network custom fields." 1606 | }, 1607 | "help": "" 1608 | }, 1609 | "option": { 1610 | "args": [], 1611 | "options": {}, 1612 | "use": "wp option", 1613 | "add": { 1614 | "args": [ 1615 | { 1616 | "required": true, 1617 | "arg": "key", 1618 | "type": "args" 1619 | }, 1620 | { 1621 | "required": false, 1622 | "arg": "value", 1623 | "type": "args" 1624 | } 1625 | ], 1626 | "options": { 1627 | "format": { 1628 | "required": false, 1629 | "type": "param" 1630 | }, 1631 | "autoload": { 1632 | "required": false, 1633 | "type": "param" 1634 | } 1635 | }, 1636 | "use": "wp option add", 1637 | "endpoint": true, 1638 | "help": "Add an option." 1639 | }, 1640 | "delete": { 1641 | "args": [ 1642 | { 1643 | "required": true, 1644 | "arg": "key", 1645 | "type": "args" 1646 | } 1647 | ], 1648 | "options": {}, 1649 | "use": "wp option delete", 1650 | "endpoint": true, 1651 | "help": "Delete an option." 1652 | }, 1653 | "get": { 1654 | "args": [ 1655 | { 1656 | "required": true, 1657 | "arg": "key", 1658 | "type": "args" 1659 | } 1660 | ], 1661 | "options": { 1662 | "format": { 1663 | "required": false, 1664 | "type": "param" 1665 | } 1666 | }, 1667 | "use": "wp option get", 1668 | "endpoint": true, 1669 | "help": "Get an option." 1670 | }, 1671 | "update": { 1672 | "args": [ 1673 | { 1674 | "required": true, 1675 | "arg": "key", 1676 | "type": "args" 1677 | }, 1678 | { 1679 | "required": false, 1680 | "arg": "value", 1681 | "type": "args" 1682 | } 1683 | ], 1684 | "options": { 1685 | "format": { 1686 | "required": false, 1687 | "type": "param" 1688 | } 1689 | }, 1690 | "use": "wp option update", 1691 | "endpoint": true, 1692 | "help": "Update an option." 1693 | }, 1694 | "help": "Manage options." 1695 | }, 1696 | "plugin": { 1697 | "args": [], 1698 | "options": {}, 1699 | "use": "wp plugin", 1700 | "activate": { 1701 | "args": [ 1702 | { 1703 | "required": true, 1704 | "arg": "plugin", 1705 | "type": "args" 1706 | } 1707 | ], 1708 | "options": { 1709 | "network": { 1710 | "required": false, 1711 | "type": "flag" 1712 | } 1713 | }, 1714 | "use": "wp plugin activate", 1715 | "endpoint": true, 1716 | "help": "Activate a plugin." 1717 | }, 1718 | "deactivate": { 1719 | "args": [ 1720 | { 1721 | "required": false, 1722 | "arg": "plugin", 1723 | "type": "args" 1724 | } 1725 | ], 1726 | "options": { 1727 | "all": { 1728 | "required": false, 1729 | "type": "flag" 1730 | }, 1731 | "network": { 1732 | "required": false, 1733 | "type": "flag" 1734 | } 1735 | }, 1736 | "use": "wp plugin deactivate", 1737 | "endpoint": true, 1738 | "help": "Deactivate a plugin." 1739 | }, 1740 | "delete": { 1741 | "args": [ 1742 | { 1743 | "required": true, 1744 | "arg": "plugin", 1745 | "type": "args" 1746 | } 1747 | ], 1748 | "options": {}, 1749 | "use": "wp plugin delete", 1750 | "endpoint": true, 1751 | "help": "Delete plugin files." 1752 | }, 1753 | "get": { 1754 | "args": [ 1755 | { 1756 | "required": true, 1757 | "arg": "plugin", 1758 | "type": "args" 1759 | } 1760 | ], 1761 | "options": { 1762 | "field": { 1763 | "required": false, 1764 | "type": "param" 1765 | }, 1766 | "format": { 1767 | "required": false, 1768 | "type": "param" 1769 | } 1770 | }, 1771 | "use": "wp plugin get", 1772 | "endpoint": true, 1773 | "help": "Get a plugin." 1774 | }, 1775 | "install": { 1776 | "args": [ 1777 | { 1778 | "required": true, 1779 | "arg": "plugin|zip|url", 1780 | "type": "args" 1781 | } 1782 | ], 1783 | "options": { 1784 | "version": { 1785 | "required": false, 1786 | "type": "param" 1787 | }, 1788 | "force": { 1789 | "required": false, 1790 | "type": "flag" 1791 | }, 1792 | "activate": { 1793 | "required": false, 1794 | "type": "flag" 1795 | }, 1796 | "activate-network": { 1797 | "required": false, 1798 | "type": "flag" 1799 | } 1800 | }, 1801 | "use": "wp plugin install", 1802 | "endpoint": true, 1803 | "help": "Install a plugin." 1804 | }, 1805 | "is_installed": { 1806 | "args": [ 1807 | { 1808 | "required": true, 1809 | "arg": "plugin", 1810 | "type": "args" 1811 | } 1812 | ], 1813 | "options": {}, 1814 | "use": "wp plugin is-installed", 1815 | "endpoint": true, 1816 | "help": "Check if the plugin is installed." 1817 | }, 1818 | "list": { 1819 | "args": [], 1820 | "options": { 1821 | "field": { 1822 | "required": false, 1823 | "type": "param" 1824 | }, 1825 | "fields": { 1826 | "required": false, 1827 | "type": "param" 1828 | }, 1829 | "format": { 1830 | "required": false, 1831 | "type": "param" 1832 | } 1833 | }, 1834 | "use": "wp plugin list", 1835 | "endpoint": true, 1836 | "help": "Get a list of plugins." 1837 | }, 1838 | "path": { 1839 | "args": [ 1840 | { 1841 | "required": false, 1842 | "arg": "plugin", 1843 | "type": "args" 1844 | } 1845 | ], 1846 | "options": { 1847 | "dir": { 1848 | "required": false, 1849 | "type": "flag" 1850 | } 1851 | }, 1852 | "use": "wp plugin path", 1853 | "endpoint": true, 1854 | "help": "Get the path to a plugin or to the plugin directory." 1855 | }, 1856 | "search": { 1857 | "args": [ 1858 | { 1859 | "required": true, 1860 | "arg": "search", 1861 | "type": "args" 1862 | } 1863 | ], 1864 | "options": { 1865 | "per-page": { 1866 | "required": false, 1867 | "type": "param" 1868 | }, 1869 | "field": { 1870 | "required": false, 1871 | "type": "param" 1872 | }, 1873 | "fields": { 1874 | "required": false, 1875 | "type": "param" 1876 | }, 1877 | "format": { 1878 | "required": false, 1879 | "type": "param" 1880 | } 1881 | }, 1882 | "use": "wp plugin search", 1883 | "endpoint": true, 1884 | "help": "Search the wordpress.org plugin repository." 1885 | }, 1886 | "status": { 1887 | "args": [ 1888 | { 1889 | "required": false, 1890 | "arg": "plugin", 1891 | "type": "args" 1892 | } 1893 | ], 1894 | "options": {}, 1895 | "use": "wp plugin status", 1896 | "endpoint": true, 1897 | "help": "See the status of one or all plugins." 1898 | }, 1899 | "toggle": { 1900 | "args": [ 1901 | { 1902 | "required": true, 1903 | "arg": "plugin", 1904 | "type": "args" 1905 | } 1906 | ], 1907 | "options": { 1908 | "network": { 1909 | "required": false, 1910 | "type": "flag" 1911 | } 1912 | }, 1913 | "use": "wp plugin toggle", 1914 | "endpoint": true, 1915 | "help": "Toggle a plugin's activation state." 1916 | }, 1917 | "uninstall": { 1918 | "args": [ 1919 | { 1920 | "required": true, 1921 | "arg": "plugin", 1922 | "type": "args" 1923 | } 1924 | ], 1925 | "options": { 1926 | "no-delete": { 1927 | "required": false, 1928 | "type": "flag" 1929 | } 1930 | }, 1931 | "use": "wp plugin uninstall", 1932 | "endpoint": true, 1933 | "help": "Uninstall a plugin." 1934 | }, 1935 | "update": { 1936 | "args": [ 1937 | { 1938 | "required": false, 1939 | "arg": "plugin", 1940 | "type": "args" 1941 | } 1942 | ], 1943 | "options": { 1944 | "all": { 1945 | "required": false, 1946 | "type": "flag" 1947 | }, 1948 | "version": { 1949 | "required": false, 1950 | "type": "param" 1951 | }, 1952 | "dry-run": { 1953 | "required": false, 1954 | "type": "flag" 1955 | } 1956 | }, 1957 | "use": "wp plugin update", 1958 | "endpoint": true, 1959 | "help": "Update one or more plugins." 1960 | }, 1961 | "help": "Manage plugins." 1962 | }, 1963 | "post": { 1964 | "args": [], 1965 | "options": {}, 1966 | "use": "wp post", 1967 | "create": { 1968 | "args": [ 1969 | { 1970 | "required": false, 1971 | "arg": "file", 1972 | "type": "args" 1973 | } 1974 | ], 1975 | "options": { 1976 | "field": { 1977 | "required": false, 1978 | "type": "param" 1979 | }, 1980 | "edit": { 1981 | "required": false, 1982 | "type": "flag" 1983 | }, 1984 | "porcelain": { 1985 | "required": false, 1986 | "type": "flag" 1987 | } 1988 | }, 1989 | "use": "wp post create", 1990 | "endpoint": true, 1991 | "help": "Create a post." 1992 | }, 1993 | "delete": { 1994 | "args": [ 1995 | { 1996 | "required": true, 1997 | "arg": "id", 1998 | "type": "args" 1999 | } 2000 | ], 2001 | "options": { 2002 | "force": { 2003 | "required": false, 2004 | "type": "flag" 2005 | } 2006 | }, 2007 | "use": "wp post delete", 2008 | "endpoint": true, 2009 | "help": "Delete a post by ID." 2010 | }, 2011 | "edit": { 2012 | "args": [ 2013 | { 2014 | "required": true, 2015 | "arg": "id", 2016 | "type": "arg" 2017 | } 2018 | ], 2019 | "options": {}, 2020 | "use": "wp post edit", 2021 | "endpoint": true, 2022 | "help": "Launch system editor to edit post content." 2023 | }, 2024 | "generate": { 2025 | "args": [], 2026 | "options": { 2027 | "count": { 2028 | "required": false, 2029 | "type": "param" 2030 | }, 2031 | "post_type": { 2032 | "required": false, 2033 | "type": "param" 2034 | }, 2035 | "post_status": { 2036 | "required": false, 2037 | "type": "param" 2038 | }, 2039 | "post_author": { 2040 | "required": false, 2041 | "type": "param" 2042 | }, 2043 | "post_date": { 2044 | "required": false, 2045 | "type": "param" 2046 | }, 2047 | "post_content": { 2048 | "required": false, 2049 | "type": "flag" 2050 | }, 2051 | "max_depth": { 2052 | "required": false, 2053 | "type": "param" 2054 | } 2055 | }, 2056 | "use": "wp post generate", 2057 | "endpoint": true, 2058 | "help": "Generate some posts." 2059 | }, 2060 | "get": { 2061 | "args": [ 2062 | { 2063 | "required": true, 2064 | "arg": "id", 2065 | "type": "arg" 2066 | } 2067 | ], 2068 | "options": { 2069 | "field": { 2070 | "required": false, 2071 | "type": "param" 2072 | }, 2073 | "format": { 2074 | "required": false, 2075 | "type": "param" 2076 | } 2077 | }, 2078 | "use": "wp post get", 2079 | "endpoint": true, 2080 | "help": "Get a post's content by ID." 2081 | }, 2082 | "list": { 2083 | "args": [], 2084 | "options": { 2085 | "field": { 2086 | "required": false, 2087 | "type": "param" 2088 | }, 2089 | "fields": { 2090 | "required": false, 2091 | "type": "param" 2092 | }, 2093 | "format": { 2094 | "required": false, 2095 | "type": "param" 2096 | } 2097 | }, 2098 | "use": "wp post list", 2099 | "endpoint": true, 2100 | "help": "Get a list of posts." 2101 | }, 2102 | "meta": { 2103 | "args": [], 2104 | "options": {}, 2105 | "use": "wp post meta", 2106 | "add": { 2107 | "args": [ 2108 | { 2109 | "required": true, 2110 | "arg": "id", 2111 | "type": "arg" 2112 | }, 2113 | { 2114 | "required": true, 2115 | "arg": "key", 2116 | "type": "args" 2117 | }, 2118 | { 2119 | "required": false, 2120 | "arg": "value", 2121 | "type": "args" 2122 | } 2123 | ], 2124 | "options": { 2125 | "format": { 2126 | "required": false, 2127 | "type": "param" 2128 | } 2129 | }, 2130 | "use": "wp post meta add", 2131 | "endpoint": true, 2132 | "help": "Add a meta field." 2133 | }, 2134 | "delete": { 2135 | "args": [ 2136 | { 2137 | "required": true, 2138 | "arg": "id", 2139 | "type": "arg" 2140 | }, 2141 | { 2142 | "required": true, 2143 | "arg": "key", 2144 | "type": "args" 2145 | } 2146 | ], 2147 | "options": {}, 2148 | "use": "wp post meta delete", 2149 | "endpoint": true, 2150 | "help": "Delete a meta field." 2151 | }, 2152 | "get": { 2153 | "args": [ 2154 | { 2155 | "required": true, 2156 | "arg": "id", 2157 | "type": "arg" 2158 | }, 2159 | { 2160 | "required": true, 2161 | "arg": "key", 2162 | "type": "args" 2163 | } 2164 | ], 2165 | "options": { 2166 | "format": { 2167 | "required": false, 2168 | "type": "param" 2169 | } 2170 | }, 2171 | "use": "wp post meta get", 2172 | "endpoint": true, 2173 | "help": "Get meta field value." 2174 | }, 2175 | "update": { 2176 | "args": [ 2177 | { 2178 | "required": true, 2179 | "arg": "id", 2180 | "type": "arg" 2181 | }, 2182 | { 2183 | "required": true, 2184 | "arg": "key", 2185 | "type": "args" 2186 | }, 2187 | { 2188 | "required": false, 2189 | "arg": "value", 2190 | "type": "args" 2191 | } 2192 | ], 2193 | "options": { 2194 | "format": { 2195 | "required": false, 2196 | "type": "param" 2197 | } 2198 | }, 2199 | "use": "wp post meta update", 2200 | "endpoint": true, 2201 | "help": "Update a meta field." 2202 | }, 2203 | "help": "Manage post custom fields." 2204 | }, 2205 | "update": { 2206 | "args": [ 2207 | { 2208 | "required": true, 2209 | "arg": "id", 2210 | "type": "args" 2211 | } 2212 | ], 2213 | "options": { 2214 | "field": { 2215 | "required": true, 2216 | "type": "param" 2217 | } 2218 | }, 2219 | "use": "wp post update", 2220 | "endpoint": true, 2221 | "help": "Update one or more posts." 2222 | }, 2223 | "url": { 2224 | "args": [ 2225 | { 2226 | "required": true, 2227 | "arg": "id", 2228 | "type": "args" 2229 | } 2230 | ], 2231 | "options": {}, 2232 | "use": "wp post url", 2233 | "endpoint": true, 2234 | "help": "Get post url" 2235 | }, 2236 | "help": "Manage posts." 2237 | }, 2238 | "rewrite": { 2239 | "args": [], 2240 | "options": {}, 2241 | "use": "wp rewrite", 2242 | "flush": { 2243 | "args": [], 2244 | "options": { 2245 | "hard": { 2246 | "required": false, 2247 | "type": "flag" 2248 | } 2249 | }, 2250 | "use": "wp rewrite flush", 2251 | "endpoint": true, 2252 | "help": "Flush rewrite rules." 2253 | }, 2254 | "list": { 2255 | "args": [], 2256 | "options": { 2257 | "match": { 2258 | "required": false, 2259 | "type": "param" 2260 | }, 2261 | "source": { 2262 | "required": false, 2263 | "type": "param" 2264 | }, 2265 | "format": { 2266 | "required": false, 2267 | "type": "param" 2268 | } 2269 | }, 2270 | "use": "wp rewrite list", 2271 | "endpoint": true, 2272 | "help": "Print current rewrite rules." 2273 | }, 2274 | "structure": { 2275 | "args": [ 2276 | { 2277 | "required": true, 2278 | "arg": "permastruct", 2279 | "type": "args" 2280 | } 2281 | ], 2282 | "options": { 2283 | "category-base": { 2284 | "required": false, 2285 | "type": "param" 2286 | }, 2287 | "tag-base": { 2288 | "required": false, 2289 | "type": "param" 2290 | }, 2291 | "hard": { 2292 | "required": false, 2293 | "type": "flag" 2294 | } 2295 | }, 2296 | "use": "wp rewrite structure", 2297 | "endpoint": true, 2298 | "help": "Update the permalink structure." 2299 | }, 2300 | "help": "Manage rewrite rules." 2301 | }, 2302 | "role": { 2303 | "args": [], 2304 | "options": {}, 2305 | "use": "wp role", 2306 | "create": { 2307 | "args": [ 2308 | { 2309 | "required": true, 2310 | "arg": "role-key", 2311 | "type": "args" 2312 | }, 2313 | { 2314 | "required": true, 2315 | "arg": "role-name", 2316 | "type": "args" 2317 | } 2318 | ], 2319 | "options": {}, 2320 | "use": "wp role create", 2321 | "endpoint": true, 2322 | "help": "Create a new role." 2323 | }, 2324 | "delete": { 2325 | "args": [ 2326 | { 2327 | "required": true, 2328 | "arg": "role-key", 2329 | "type": "args" 2330 | } 2331 | ], 2332 | "options": {}, 2333 | "use": "wp role delete", 2334 | "endpoint": true, 2335 | "help": "Delete an existing role." 2336 | }, 2337 | "exists": { 2338 | "args": [ 2339 | { 2340 | "required": true, 2341 | "arg": "role-key", 2342 | "type": "args" 2343 | } 2344 | ], 2345 | "options": {}, 2346 | "use": "wp role exists", 2347 | "endpoint": true, 2348 | "help": "Check if a role exists." 2349 | }, 2350 | "list": { 2351 | "args": [], 2352 | "options": { 2353 | "fields": { 2354 | "required": false, 2355 | "type": "param" 2356 | }, 2357 | "format": { 2358 | "required": false, 2359 | "type": "param" 2360 | } 2361 | }, 2362 | "use": "wp role list", 2363 | "endpoint": true, 2364 | "help": "List all roles." 2365 | }, 2366 | "reset": { 2367 | "args": [ 2368 | { 2369 | "required": false, 2370 | "arg": "role-key", 2371 | "type": "args" 2372 | } 2373 | ], 2374 | "options": { 2375 | "all": { 2376 | "required": false, 2377 | "type": "flag" 2378 | } 2379 | }, 2380 | "use": "wp role reset", 2381 | "endpoint": true, 2382 | "help": "Reset any default role to default capabilities." 2383 | }, 2384 | "help": "Manage user roles." 2385 | }, 2386 | "scaffold": { 2387 | "args": [], 2388 | "options": {}, 2389 | "use": "wp scaffold", 2390 | "_s": { 2391 | "args": [ 2392 | { 2393 | "required": true, 2394 | "arg": "slug", 2395 | "type": "args" 2396 | } 2397 | ], 2398 | "options": { 2399 | "activate": { 2400 | "required": false, 2401 | "type": "flag" 2402 | }, 2403 | "theme_name": { 2404 | "required": false, 2405 | "type": "param" 2406 | }, 2407 | "author": { 2408 | "required": false, 2409 | "type": "param" 2410 | }, 2411 | "author_uri": { 2412 | "required": false, 2413 | "type": "param" 2414 | } 2415 | }, 2416 | "use": "wp scaffold _s", 2417 | "endpoint": true, 2418 | "help": "Generate starter code for a theme." 2419 | }, 2420 | "child_theme": { 2421 | "args": [ 2422 | { 2423 | "required": true, 2424 | "arg": "slug", 2425 | "type": "args" 2426 | } 2427 | ], 2428 | "options": { 2429 | "parent_theme": { 2430 | "required": true, 2431 | "type": "param" 2432 | }, 2433 | "theme_name": { 2434 | "required": false, 2435 | "type": "param" 2436 | }, 2437 | "author": { 2438 | "required": false, 2439 | "type": "param" 2440 | }, 2441 | "author_uri": { 2442 | "required": false, 2443 | "type": "param" 2444 | }, 2445 | "theme_uri": { 2446 | "required": false, 2447 | "type": "param" 2448 | }, 2449 | "activate": { 2450 | "required": false, 2451 | "type": "flag" 2452 | } 2453 | }, 2454 | "use": "wp scaffold child-theme", 2455 | "endpoint": true, 2456 | "help": "Generate empty child theme." 2457 | }, 2458 | "plugin": { 2459 | "args": [ 2460 | { 2461 | "required": true, 2462 | "arg": "slug", 2463 | "type": "args" 2464 | } 2465 | ], 2466 | "options": { 2467 | "plugin_name": { 2468 | "required": false, 2469 | "type": "param" 2470 | }, 2471 | "skip-tests": { 2472 | "required": false, 2473 | "type": "flag" 2474 | }, 2475 | "activate": { 2476 | "required": false, 2477 | "type": "flag" 2478 | } 2479 | }, 2480 | "use": "wp scaffold plugin", 2481 | "endpoint": true, 2482 | "help": "Generate starter code for a plugin." 2483 | }, 2484 | "plugin_tests": { 2485 | "args": [ 2486 | { 2487 | "required": true, 2488 | "arg": "plugin", 2489 | "type": "args" 2490 | } 2491 | ], 2492 | "options": {}, 2493 | "use": "wp scaffold plugin-tests", 2494 | "endpoint": true, 2495 | "help": "Generate files needed for running PHPUnit tests." 2496 | }, 2497 | "post_type": { 2498 | "args": [ 2499 | { 2500 | "required": true, 2501 | "arg": "slug", 2502 | "type": "args" 2503 | } 2504 | ], 2505 | "options": { 2506 | "label": { 2507 | "required": false, 2508 | "type": "param" 2509 | }, 2510 | "textdomain": { 2511 | "required": false, 2512 | "type": "param" 2513 | }, 2514 | "theme": { 2515 | "required": false, 2516 | "type": "flag" 2517 | }, 2518 | "plugin": { 2519 | "required": false, 2520 | "type": "param" 2521 | }, 2522 | "raw": { 2523 | "required": false, 2524 | "type": "flag" 2525 | } 2526 | }, 2527 | "use": "wp scaffold post-type", 2528 | "endpoint": true, 2529 | "help": "Generate PHP code for registering a custom post type." 2530 | }, 2531 | "taxonomy": { 2532 | "args": [ 2533 | { 2534 | "required": true, 2535 | "arg": "slug", 2536 | "type": "args" 2537 | } 2538 | ], 2539 | "options": { 2540 | "post_types": { 2541 | "required": false, 2542 | "type": "param" 2543 | }, 2544 | "label": { 2545 | "required": false, 2546 | "type": "param" 2547 | }, 2548 | "textdomain": { 2549 | "required": false, 2550 | "type": "param" 2551 | }, 2552 | "theme": { 2553 | "required": false, 2554 | "type": "flag" 2555 | }, 2556 | "plugin": { 2557 | "required": false, 2558 | "type": "param" 2559 | }, 2560 | "raw": { 2561 | "required": false, 2562 | "type": "flag" 2563 | } 2564 | }, 2565 | "use": "wp scaffold taxonomy", 2566 | "endpoint": true, 2567 | "help": "Generate PHP code for registering a custom taxonomy." 2568 | }, 2569 | "help": "Generate code for post types, taxonomies, etc." 2570 | }, 2571 | "search_replace": { 2572 | "args": [ 2573 | { 2574 | "required": true, 2575 | "arg": "old", 2576 | "type": "args" 2577 | }, 2578 | { 2579 | "required": true, 2580 | "arg": "new", 2581 | "type": "args" 2582 | }, 2583 | { 2584 | "required": false, 2585 | "arg": "table", 2586 | "type": "args" 2587 | } 2588 | ], 2589 | "options": { 2590 | "network": { 2591 | "required": false, 2592 | "type": "flag" 2593 | }, 2594 | "skip-columns": { 2595 | "required": false, 2596 | "type": "param" 2597 | }, 2598 | "dry-run": { 2599 | "required": false, 2600 | "type": "flag" 2601 | }, 2602 | "recurse-objects": { 2603 | "required": false, 2604 | "type": "flag" 2605 | } 2606 | }, 2607 | "use": "wp search-replace", 2608 | "endpoint": true, 2609 | "help": "Search/replace strings in the database." 2610 | }, 2611 | "shell": { 2612 | "args": [], 2613 | "options": { 2614 | "basic": { 2615 | "required": false, 2616 | "type": "flag" 2617 | } 2618 | }, 2619 | "use": "wp shell", 2620 | "endpoint": true, 2621 | "help": "Interactive PHP console." 2622 | }, 2623 | "sidebar": { 2624 | "args": [], 2625 | "options": {}, 2626 | "use": "wp sidebar", 2627 | "list": { 2628 | "args": [], 2629 | "options": { 2630 | "fields": { 2631 | "required": false, 2632 | "type": "param" 2633 | }, 2634 | "format": { 2635 | "required": false, 2636 | "type": "param" 2637 | } 2638 | }, 2639 | "use": "wp sidebar list", 2640 | "endpoint": true, 2641 | "help": "List registered sidebars." 2642 | }, 2643 | "help": "Manage sidebars." 2644 | }, 2645 | "site": { 2646 | "args": [], 2647 | "options": {}, 2648 | "use": "wp site", 2649 | "create": { 2650 | "args": [], 2651 | "options": { 2652 | "slug": { 2653 | "required": true, 2654 | "type": "param" 2655 | }, 2656 | "title": { 2657 | "required": false, 2658 | "type": "param" 2659 | }, 2660 | "email": { 2661 | "required": false, 2662 | "type": "param" 2663 | }, 2664 | "network_id": { 2665 | "required": false, 2666 | "type": "param" 2667 | }, 2668 | "private": { 2669 | "required": false, 2670 | "type": "flag" 2671 | }, 2672 | "porcelain": { 2673 | "required": false, 2674 | "type": "flag" 2675 | } 2676 | }, 2677 | "use": "wp site create", 2678 | "endpoint": true, 2679 | "help": "Create a site in a multisite install." 2680 | }, 2681 | "delete": { 2682 | "args": [ 2683 | { 2684 | "required": false, 2685 | "arg": "site-id", 2686 | "type": "args" 2687 | } 2688 | ], 2689 | "options": { 2690 | "slug": { 2691 | "required": false, 2692 | "type": "param" 2693 | }, 2694 | "yes": { 2695 | "required": false, 2696 | "type": "flag" 2697 | }, 2698 | "keep-tables": { 2699 | "required": false, 2700 | "type": "flag" 2701 | } 2702 | }, 2703 | "use": "wp site delete", 2704 | "endpoint": true, 2705 | "help": "Delete a site in a multisite install." 2706 | }, 2707 | "empty": { 2708 | "args": [], 2709 | "options": { 2710 | "yes": { 2711 | "required": false, 2712 | "type": "flag" 2713 | } 2714 | }, 2715 | "use": "wp site empty", 2716 | "endpoint": true, 2717 | "help": "Empty a site of its content (posts, comments, and terms)." 2718 | }, 2719 | "list": { 2720 | "args": [], 2721 | "options": { 2722 | "network": { 2723 | "required": false, 2724 | "type": "param" 2725 | }, 2726 | "field": { 2727 | "required": false, 2728 | "type": "param" 2729 | }, 2730 | "fields": { 2731 | "required": false, 2732 | "type": "param" 2733 | }, 2734 | "format": { 2735 | "required": false, 2736 | "type": "param" 2737 | } 2738 | }, 2739 | "use": "wp site list", 2740 | "endpoint": true, 2741 | "help": "List all sites in a multisite install." 2742 | }, 2743 | "url": { 2744 | "args": [ 2745 | { 2746 | "required": true, 2747 | "arg": "id", 2748 | "type": "args" 2749 | } 2750 | ], 2751 | "options": {}, 2752 | "use": "wp site url", 2753 | "endpoint": true, 2754 | "help": "Get site url" 2755 | }, 2756 | "help": "Perform site-wide operations." 2757 | }, 2758 | "super_admin": { 2759 | "args": [], 2760 | "options": {}, 2761 | "use": "wp super-admin", 2762 | "add": { 2763 | "args": [ 2764 | { 2765 | "required": true, 2766 | "arg": "user", 2767 | "type": "args" 2768 | } 2769 | ], 2770 | "options": {}, 2771 | "use": "wp super-admin add", 2772 | "endpoint": true, 2773 | "help": "Grant super-admin privileges to one or more users." 2774 | }, 2775 | "list": { 2776 | "args": [], 2777 | "options": {}, 2778 | "use": "wp super-admin list", 2779 | "endpoint": true, 2780 | "help": "Show a list of users with super-admin capabilities." 2781 | }, 2782 | "remove": { 2783 | "args": [ 2784 | { 2785 | "required": true, 2786 | "arg": "user", 2787 | "type": "args" 2788 | } 2789 | ], 2790 | "options": {}, 2791 | "use": "wp super-admin remove", 2792 | "endpoint": true, 2793 | "help": "Revoke super-admin privileges to one or more users." 2794 | }, 2795 | "help": "List, add, and remove super admins from a network." 2796 | }, 2797 | "term": { 2798 | "args": [], 2799 | "options": {}, 2800 | "use": "wp term", 2801 | "create": { 2802 | "args": [ 2803 | { 2804 | "required": true, 2805 | "arg": "taxonomy", 2806 | "type": "args" 2807 | }, 2808 | { 2809 | "required": true, 2810 | "arg": "term", 2811 | "type": "args" 2812 | } 2813 | ], 2814 | "options": { 2815 | "slug": { 2816 | "required": false, 2817 | "type": "param" 2818 | }, 2819 | "description": { 2820 | "required": false, 2821 | "type": "param" 2822 | }, 2823 | "parent": { 2824 | "required": false, 2825 | "type": "param" 2826 | }, 2827 | "porcelain": { 2828 | "required": false, 2829 | "type": "flag" 2830 | } 2831 | }, 2832 | "use": "wp term create", 2833 | "endpoint": true, 2834 | "help": "Create a term." 2835 | }, 2836 | "delete": { 2837 | "args": [ 2838 | { 2839 | "required": true, 2840 | "arg": "taxonomy", 2841 | "type": "args" 2842 | }, 2843 | { 2844 | "required": true, 2845 | "arg": "term-id", 2846 | "type": "args" 2847 | } 2848 | ], 2849 | "options": {}, 2850 | "use": "wp term delete", 2851 | "endpoint": true, 2852 | "help": "Delete a term." 2853 | }, 2854 | "generate": { 2855 | "args": [ 2856 | { 2857 | "required": true, 2858 | "arg": "taxonomy", 2859 | "type": "args" 2860 | } 2861 | ], 2862 | "options": { 2863 | "count": { 2864 | "required": false, 2865 | "type": "param" 2866 | }, 2867 | "max_depth": { 2868 | "required": false, 2869 | "type": "param" 2870 | } 2871 | }, 2872 | "use": "wp term generate", 2873 | "endpoint": true, 2874 | "help": "Generate some terms." 2875 | }, 2876 | "get": { 2877 | "args": [ 2878 | { 2879 | "required": true, 2880 | "arg": "taxonomy", 2881 | "type": "args" 2882 | }, 2883 | { 2884 | "required": true, 2885 | "arg": "term-id", 2886 | "type": "args" 2887 | } 2888 | ], 2889 | "options": { 2890 | "field": { 2891 | "required": false, 2892 | "type": "param" 2893 | }, 2894 | "format": { 2895 | "required": false, 2896 | "type": "param" 2897 | } 2898 | }, 2899 | "use": "wp term get", 2900 | "endpoint": true, 2901 | "help": "Get a taxonomy term" 2902 | }, 2903 | "list": { 2904 | "args": [ 2905 | { 2906 | "required": true, 2907 | "arg": "taxonomy", 2908 | "type": "args" 2909 | } 2910 | ], 2911 | "options": { 2912 | "field": { 2913 | "required": false, 2914 | "type": "param" 2915 | }, 2916 | "fields": { 2917 | "required": false, 2918 | "type": "param" 2919 | }, 2920 | "format": { 2921 | "required": false, 2922 | "type": "param" 2923 | } 2924 | }, 2925 | "use": "wp term list", 2926 | "endpoint": true, 2927 | "help": "List terms in a taxonomy." 2928 | }, 2929 | "update": { 2930 | "args": [ 2931 | { 2932 | "required": true, 2933 | "arg": "taxonomy", 2934 | "type": "args" 2935 | }, 2936 | { 2937 | "required": true, 2938 | "arg": "term-id", 2939 | "type": "args" 2940 | } 2941 | ], 2942 | "options": { 2943 | "name": { 2944 | "required": false, 2945 | "type": "param" 2946 | }, 2947 | "slug": { 2948 | "required": false, 2949 | "type": "param" 2950 | }, 2951 | "description": { 2952 | "required": false, 2953 | "type": "param" 2954 | }, 2955 | "parent": { 2956 | "required": false, 2957 | "type": "param" 2958 | } 2959 | }, 2960 | "use": "wp term update", 2961 | "endpoint": true, 2962 | "help": "Update a term." 2963 | }, 2964 | "url": { 2965 | "args": [ 2966 | { 2967 | "required": true, 2968 | "arg": "taxonomy", 2969 | "type": "args" 2970 | }, 2971 | { 2972 | "required": true, 2973 | "arg": "term-id", 2974 | "type": "args" 2975 | } 2976 | ], 2977 | "options": {}, 2978 | "use": "wp term url", 2979 | "endpoint": true, 2980 | "help": "Get term url" 2981 | }, 2982 | "help": "Manage terms." 2983 | }, 2984 | "theme": { 2985 | "args": [], 2986 | "options": {}, 2987 | "use": "wp theme", 2988 | "activate": { 2989 | "args": [ 2990 | { 2991 | "required": true, 2992 | "arg": "theme", 2993 | "type": "args" 2994 | } 2995 | ], 2996 | "options": {}, 2997 | "use": "wp theme activate", 2998 | "endpoint": true, 2999 | "help": "Activate a theme." 3000 | }, 3001 | "delete": { 3002 | "args": [ 3003 | { 3004 | "required": true, 3005 | "arg": "theme", 3006 | "type": "args" 3007 | } 3008 | ], 3009 | "options": {}, 3010 | "use": "wp theme delete", 3011 | "endpoint": true, 3012 | "help": "Delete a theme." 3013 | }, 3014 | "disable": { 3015 | "args": [ 3016 | { 3017 | "required": true, 3018 | "arg": "theme", 3019 | "type": "args" 3020 | } 3021 | ], 3022 | "options": { 3023 | "network": { 3024 | "required": false, 3025 | "type": "flag" 3026 | } 3027 | }, 3028 | "use": "wp theme disable", 3029 | "endpoint": true, 3030 | "help": "Disable a theme in a multisite install." 3031 | }, 3032 | "enable": { 3033 | "args": [ 3034 | { 3035 | "required": true, 3036 | "arg": "theme", 3037 | "type": "args" 3038 | } 3039 | ], 3040 | "options": { 3041 | "network": { 3042 | "required": false, 3043 | "type": "flag" 3044 | }, 3045 | "activate": { 3046 | "required": false, 3047 | "type": "flag" 3048 | } 3049 | }, 3050 | "use": "wp theme enable", 3051 | "endpoint": true, 3052 | "help": "Enable a theme in a multisite install." 3053 | }, 3054 | "get": { 3055 | "args": [ 3056 | { 3057 | "required": true, 3058 | "arg": "theme", 3059 | "type": "args" 3060 | } 3061 | ], 3062 | "options": { 3063 | "field": { 3064 | "required": false, 3065 | "type": "param" 3066 | }, 3067 | "format": { 3068 | "required": false, 3069 | "type": "param" 3070 | } 3071 | }, 3072 | "use": "wp theme get", 3073 | "endpoint": true, 3074 | "help": "Get a theme" 3075 | }, 3076 | "install": { 3077 | "args": [ 3078 | { 3079 | "required": true, 3080 | "arg": "theme|zip|url", 3081 | "type": "args" 3082 | } 3083 | ], 3084 | "options": { 3085 | "version": { 3086 | "required": false, 3087 | "type": "param" 3088 | }, 3089 | "force": { 3090 | "required": false, 3091 | "type": "flag" 3092 | }, 3093 | "activate": { 3094 | "required": false, 3095 | "type": "flag" 3096 | } 3097 | }, 3098 | "use": "wp theme install", 3099 | "endpoint": true, 3100 | "help": "Install a theme." 3101 | }, 3102 | "is_installed": { 3103 | "args": [ 3104 | { 3105 | "required": true, 3106 | "arg": "theme", 3107 | "type": "args" 3108 | } 3109 | ], 3110 | "options": {}, 3111 | "use": "wp theme is-installed", 3112 | "endpoint": true, 3113 | "help": "Check if the theme is installed." 3114 | }, 3115 | "list": { 3116 | "args": [], 3117 | "options": { 3118 | "field": { 3119 | "required": false, 3120 | "type": "param" 3121 | }, 3122 | "fields": { 3123 | "required": false, 3124 | "type": "param" 3125 | }, 3126 | "format": { 3127 | "required": false, 3128 | "type": "param" 3129 | } 3130 | }, 3131 | "use": "wp theme list", 3132 | "endpoint": true, 3133 | "help": "Get a list of themes." 3134 | }, 3135 | "mod": { 3136 | "args": [], 3137 | "options": {}, 3138 | "use": "wp theme mod", 3139 | "get": { 3140 | "args": [ 3141 | { 3142 | "required": false, 3143 | "arg": "mod", 3144 | "type": "args" 3145 | } 3146 | ], 3147 | "options": { 3148 | "all": { 3149 | "required": false, 3150 | "type": "flag" 3151 | }, 3152 | "format": { 3153 | "required": false, 3154 | "type": "param" 3155 | } 3156 | }, 3157 | "use": "wp theme mod get", 3158 | "endpoint": true, 3159 | "help": "Get theme mod(s)." 3160 | }, 3161 | "remove": { 3162 | "args": [ 3163 | { 3164 | "required": false, 3165 | "arg": "mod", 3166 | "type": "args" 3167 | } 3168 | ], 3169 | "options": { 3170 | "all": { 3171 | "required": false, 3172 | "type": "flag" 3173 | } 3174 | }, 3175 | "use": "wp theme mod remove", 3176 | "endpoint": true, 3177 | "help": "Remove theme mod(s)." 3178 | }, 3179 | "set": { 3180 | "args": [ 3181 | { 3182 | "required": true, 3183 | "arg": "mod", 3184 | "type": "args" 3185 | }, 3186 | { 3187 | "required": true, 3188 | "arg": "value", 3189 | "type": "args" 3190 | } 3191 | ], 3192 | "options": {}, 3193 | "use": "wp theme mod set", 3194 | "endpoint": true, 3195 | "help": "Set a theme mod." 3196 | }, 3197 | "help": "Manage theme mods." 3198 | }, 3199 | "path": { 3200 | "args": [ 3201 | { 3202 | "required": false, 3203 | "arg": "theme", 3204 | "type": "args" 3205 | } 3206 | ], 3207 | "options": { 3208 | "dir": { 3209 | "required": false, 3210 | "type": "flag" 3211 | } 3212 | }, 3213 | "use": "wp theme path", 3214 | "endpoint": true, 3215 | "help": "Get the path to a theme or to the theme directory." 3216 | }, 3217 | "search": { 3218 | "args": [ 3219 | { 3220 | "required": true, 3221 | "arg": "search", 3222 | "type": "args" 3223 | } 3224 | ], 3225 | "options": { 3226 | "per-page": { 3227 | "required": false, 3228 | "type": "param" 3229 | }, 3230 | "field": { 3231 | "required": false, 3232 | "type": "param" 3233 | }, 3234 | "fields": { 3235 | "required": false, 3236 | "type": "param" 3237 | }, 3238 | "format": { 3239 | "required": false, 3240 | "type": "param" 3241 | } 3242 | }, 3243 | "use": "wp theme search", 3244 | "endpoint": true, 3245 | "help": "Search the wordpress.org theme repository." 3246 | }, 3247 | "status": { 3248 | "args": [ 3249 | { 3250 | "required": false, 3251 | "arg": "theme", 3252 | "type": "args" 3253 | } 3254 | ], 3255 | "options": {}, 3256 | "use": "wp theme status", 3257 | "endpoint": true, 3258 | "help": "See the status of one or all themes." 3259 | }, 3260 | "update": { 3261 | "args": [ 3262 | { 3263 | "required": false, 3264 | "arg": "theme", 3265 | "type": "args" 3266 | } 3267 | ], 3268 | "options": { 3269 | "all": { 3270 | "required": false, 3271 | "type": "flag" 3272 | }, 3273 | "version": { 3274 | "required": false, 3275 | "type": "param" 3276 | }, 3277 | "dry-run": { 3278 | "required": false, 3279 | "type": "flag" 3280 | } 3281 | }, 3282 | "use": "wp theme update", 3283 | "endpoint": true, 3284 | "help": "Update one or more themes." 3285 | }, 3286 | "help": "Manage themes." 3287 | }, 3288 | "transient": { 3289 | "args": [], 3290 | "options": {}, 3291 | "use": "wp transient", 3292 | "delete": { 3293 | "args": [ 3294 | { 3295 | "required": true, 3296 | "arg": "key", 3297 | "type": "args" 3298 | } 3299 | ], 3300 | "options": {}, 3301 | "use": "wp transient delete", 3302 | "endpoint": true, 3303 | "help": "Delete a transient value." 3304 | }, 3305 | "delete_all": { 3306 | "args": [], 3307 | "options": {}, 3308 | "use": "wp transient delete-all", 3309 | "endpoint": true, 3310 | "help": "Delete all transients." 3311 | }, 3312 | "delete_expired": { 3313 | "args": [], 3314 | "options": {}, 3315 | "use": "wp transient delete-expired", 3316 | "endpoint": true, 3317 | "help": "Delete all expired transients." 3318 | }, 3319 | "get": { 3320 | "args": [ 3321 | { 3322 | "required": true, 3323 | "arg": "key", 3324 | "type": "args" 3325 | } 3326 | ], 3327 | "options": { 3328 | "json": { 3329 | "required": false, 3330 | "type": "flag" 3331 | } 3332 | }, 3333 | "use": "wp transient get", 3334 | "endpoint": true, 3335 | "help": "Get a transient value." 3336 | }, 3337 | "set": { 3338 | "args": [ 3339 | { 3340 | "required": true, 3341 | "arg": "key", 3342 | "type": "args" 3343 | }, 3344 | { 3345 | "required": true, 3346 | "arg": "value", 3347 | "type": "args" 3348 | }, 3349 | { 3350 | "required": false, 3351 | "arg": "expiration", 3352 | "type": "args" 3353 | } 3354 | ], 3355 | "options": {}, 3356 | "use": "wp transient set", 3357 | "endpoint": true, 3358 | "help": "Set a transient value. is the time until expiration, in seconds." 3359 | }, 3360 | "type": { 3361 | "args": [], 3362 | "options": {}, 3363 | "use": "wp transient type", 3364 | "endpoint": true, 3365 | "help": "See whether the transients API is using an object cache or the options table." 3366 | }, 3367 | "help": "Manage transients." 3368 | }, 3369 | "user": { 3370 | "args": [], 3371 | "options": {}, 3372 | "use": "wp user", 3373 | "add_cap": { 3374 | "args": [ 3375 | { 3376 | "required": true, 3377 | "arg": "user", 3378 | "type": "args" 3379 | }, 3380 | { 3381 | "required": true, 3382 | "arg": "cap", 3383 | "type": "args" 3384 | } 3385 | ], 3386 | "options": {}, 3387 | "use": "wp user add-cap", 3388 | "endpoint": true, 3389 | "help": "Add a capability for a user." 3390 | }, 3391 | "add_role": { 3392 | "args": [ 3393 | { 3394 | "required": true, 3395 | "arg": "user", 3396 | "type": "args" 3397 | }, 3398 | { 3399 | "required": true, 3400 | "arg": "role", 3401 | "type": "args" 3402 | } 3403 | ], 3404 | "options": {}, 3405 | "use": "wp user add-role", 3406 | "endpoint": true, 3407 | "help": "Add a role for a user." 3408 | }, 3409 | "create": { 3410 | "args": [ 3411 | { 3412 | "required": true, 3413 | "arg": "user-login", 3414 | "type": "args" 3415 | }, 3416 | { 3417 | "required": true, 3418 | "arg": "user-email", 3419 | "type": "args" 3420 | } 3421 | ], 3422 | "options": { 3423 | "role": { 3424 | "required": false, 3425 | "type": "param" 3426 | }, 3427 | "user_pass": { 3428 | "required": false, 3429 | "type": "param" 3430 | }, 3431 | "user_registered": { 3432 | "required": false, 3433 | "type": "param" 3434 | }, 3435 | "display_name": { 3436 | "required": false, 3437 | "type": "param" 3438 | }, 3439 | "send-email": { 3440 | "required": false, 3441 | "type": "flag" 3442 | }, 3443 | "porcelain": { 3444 | "required": false, 3445 | "type": "flag" 3446 | } 3447 | }, 3448 | "use": "wp user create", 3449 | "endpoint": true, 3450 | "help": "Create a user." 3451 | }, 3452 | "delete": { 3453 | "args": [ 3454 | { 3455 | "required": true, 3456 | "arg": "user", 3457 | "type": "args" 3458 | } 3459 | ], 3460 | "options": { 3461 | "network": { 3462 | "required": false, 3463 | "type": "flag" 3464 | }, 3465 | "reassign": { 3466 | "required": false, 3467 | "type": "param" 3468 | }, 3469 | "yes": { 3470 | "required": false, 3471 | "type": "flag" 3472 | } 3473 | }, 3474 | "use": "wp user delete", 3475 | "endpoint": true, 3476 | "help": "Delete one or more users from the current site." 3477 | }, 3478 | "generate": { 3479 | "args": [], 3480 | "options": { 3481 | "count": { 3482 | "required": false, 3483 | "type": "param" 3484 | }, 3485 | "role": { 3486 | "required": false, 3487 | "type": "param" 3488 | } 3489 | }, 3490 | "use": "wp user generate", 3491 | "endpoint": true, 3492 | "help": "Generate users." 3493 | }, 3494 | "get": { 3495 | "args": [ 3496 | { 3497 | "required": true, 3498 | "arg": "user", 3499 | "type": "args" 3500 | } 3501 | ], 3502 | "options": { 3503 | "field": { 3504 | "required": false, 3505 | "type": "param" 3506 | }, 3507 | "format": { 3508 | "required": false, 3509 | "type": "param" 3510 | } 3511 | }, 3512 | "use": "wp user get", 3513 | "endpoint": true, 3514 | "help": "Get a single user." 3515 | }, 3516 | "import_csv": { 3517 | "args": [ 3518 | { 3519 | "required": true, 3520 | "arg": "file", 3521 | "type": "args" 3522 | } 3523 | ], 3524 | "options": { 3525 | "send-email": { 3526 | "required": false, 3527 | "type": "flag" 3528 | } 3529 | }, 3530 | "use": "wp user import-csv", 3531 | "endpoint": true, 3532 | "help": "Import users from a CSV file." 3533 | }, 3534 | "list": { 3535 | "args": [], 3536 | "options": { 3537 | "role": { 3538 | "required": false, 3539 | "type": "param" 3540 | }, 3541 | "field": { 3542 | "required": false, 3543 | "type": "param" 3544 | }, 3545 | "fields": { 3546 | "required": false, 3547 | "type": "param" 3548 | }, 3549 | "format": { 3550 | "required": false, 3551 | "type": "param" 3552 | } 3553 | }, 3554 | "use": "wp user list", 3555 | "endpoint": true, 3556 | "help": "List users." 3557 | }, 3558 | "list_caps": { 3559 | "args": [ 3560 | { 3561 | "required": true, 3562 | "arg": "user", 3563 | "type": "args" 3564 | } 3565 | ], 3566 | "options": {}, 3567 | "use": "wp user list-caps", 3568 | "endpoint": true, 3569 | "help": "List all user's capabilities." 3570 | }, 3571 | "meta": { 3572 | "args": [], 3573 | "options": {}, 3574 | "use": "wp user meta", 3575 | "add": { 3576 | "args": [ 3577 | { 3578 | "required": true, 3579 | "arg": "user", 3580 | "type": "args" 3581 | }, 3582 | { 3583 | "required": true, 3584 | "arg": "key", 3585 | "type": "args" 3586 | }, 3587 | { 3588 | "required": true, 3589 | "arg": "value", 3590 | "type": "args" 3591 | } 3592 | ], 3593 | "options": { 3594 | "format": { 3595 | "required": false, 3596 | "type": "param" 3597 | } 3598 | }, 3599 | "use": "wp user meta add", 3600 | "endpoint": true, 3601 | "help": "Add a meta field." 3602 | }, 3603 | "delete": { 3604 | "args": [ 3605 | { 3606 | "required": true, 3607 | "arg": "user", 3608 | "type": "args" 3609 | }, 3610 | { 3611 | "required": true, 3612 | "arg": "key", 3613 | "type": "args" 3614 | } 3615 | ], 3616 | "options": {}, 3617 | "use": "wp user meta delete", 3618 | "endpoint": true, 3619 | "help": "Delete a meta field." 3620 | }, 3621 | "get": { 3622 | "args": [ 3623 | { 3624 | "required": true, 3625 | "arg": "user", 3626 | "type": "args" 3627 | }, 3628 | { 3629 | "required": true, 3630 | "arg": "key", 3631 | "type": "args" 3632 | } 3633 | ], 3634 | "options": { 3635 | "format": { 3636 | "required": false, 3637 | "type": "param" 3638 | } 3639 | }, 3640 | "use": "wp user meta get", 3641 | "endpoint": true, 3642 | "help": "Get meta field value." 3643 | }, 3644 | "update": { 3645 | "args": [ 3646 | { 3647 | "required": true, 3648 | "arg": "user", 3649 | "type": "args" 3650 | }, 3651 | { 3652 | "required": true, 3653 | "arg": "key", 3654 | "type": "args" 3655 | }, 3656 | { 3657 | "required": true, 3658 | "arg": "value", 3659 | "type": "args" 3660 | } 3661 | ], 3662 | "options": { 3663 | "format": { 3664 | "required": false, 3665 | "type": "param" 3666 | } 3667 | }, 3668 | "use": "wp user meta update", 3669 | "endpoint": true, 3670 | "help": "Update a meta field." 3671 | }, 3672 | "help": "Manage user custom fields." 3673 | }, 3674 | "remove_cap": { 3675 | "args": [ 3676 | { 3677 | "required": true, 3678 | "arg": "user", 3679 | "type": "args" 3680 | }, 3681 | { 3682 | "required": true, 3683 | "arg": "cap", 3684 | "type": "args" 3685 | } 3686 | ], 3687 | "options": {}, 3688 | "use": "wp user remove-cap", 3689 | "endpoint": true, 3690 | "help": "Remove a user's capability." 3691 | }, 3692 | "remove_role": { 3693 | "args": [ 3694 | { 3695 | "required": true, 3696 | "arg": "user", 3697 | "type": "args" 3698 | }, 3699 | { 3700 | "required": false, 3701 | "arg": "role", 3702 | "type": "args" 3703 | } 3704 | ], 3705 | "options": {}, 3706 | "use": "wp user remove-role", 3707 | "endpoint": true, 3708 | "help": "Remove a user's role." 3709 | }, 3710 | "set_role": { 3711 | "args": [ 3712 | { 3713 | "required": true, 3714 | "arg": "user", 3715 | "type": "args" 3716 | }, 3717 | { 3718 | "required": false, 3719 | "arg": "role", 3720 | "type": "args" 3721 | } 3722 | ], 3723 | "options": {}, 3724 | "use": "wp user set-role", 3725 | "endpoint": true, 3726 | "help": "Set the user role (for a particular blog)." 3727 | }, 3728 | "update": { 3729 | "args": [ 3730 | { 3731 | "required": true, 3732 | "arg": "user", 3733 | "type": "args" 3734 | } 3735 | ], 3736 | "options": { 3737 | "field": { 3738 | "required": true, 3739 | "type": "param" 3740 | } 3741 | }, 3742 | "use": "wp user update", 3743 | "endpoint": true, 3744 | "help": "Update a user." 3745 | }, 3746 | "help": "Manage users." 3747 | }, 3748 | "widget": { 3749 | "args": [], 3750 | "options": {}, 3751 | "use": "wp widget", 3752 | "add": { 3753 | "args": [ 3754 | { 3755 | "required": true, 3756 | "arg": "name", 3757 | "type": "args" 3758 | }, 3759 | { 3760 | "required": true, 3761 | "arg": "sidebar-id", 3762 | "type": "args" 3763 | }, 3764 | { 3765 | "required": false, 3766 | "arg": "position", 3767 | "type": "args" 3768 | } 3769 | ], 3770 | "options": { 3771 | "field": { 3772 | "required": false, 3773 | "type": "param" 3774 | } 3775 | }, 3776 | "use": "wp widget add", 3777 | "endpoint": true, 3778 | "help": "Add a widget to a sidebar." 3779 | }, 3780 | "deactivate": { 3781 | "args": [ 3782 | { 3783 | "required": true, 3784 | "arg": "widget-id", 3785 | "type": "args" 3786 | } 3787 | ], 3788 | "options": {}, 3789 | "use": "wp widget deactivate", 3790 | "endpoint": true, 3791 | "help": "Deactivate one or more widgets from an active sidebar." 3792 | }, 3793 | "delete": { 3794 | "args": [ 3795 | { 3796 | "required": true, 3797 | "arg": "widget-id", 3798 | "type": "args" 3799 | } 3800 | ], 3801 | "options": {}, 3802 | "use": "wp widget delete", 3803 | "endpoint": true, 3804 | "help": "Delete one or more widgets from a sidebar." 3805 | }, 3806 | "list": { 3807 | "args": [ 3808 | { 3809 | "required": true, 3810 | "arg": "sidebar-id", 3811 | "type": "args" 3812 | } 3813 | ], 3814 | "options": { 3815 | "fields": { 3816 | "required": false, 3817 | "type": "param" 3818 | }, 3819 | "format": { 3820 | "required": false, 3821 | "type": "param" 3822 | } 3823 | }, 3824 | "use": "wp widget list", 3825 | "endpoint": true, 3826 | "help": "List widgets associated with a sidebar." 3827 | }, 3828 | "move": { 3829 | "args": [ 3830 | { 3831 | "required": true, 3832 | "arg": "widget-id", 3833 | "type": "args" 3834 | } 3835 | ], 3836 | "options": { 3837 | "position": { 3838 | "required": false, 3839 | "type": "param" 3840 | }, 3841 | "sidebar-id": { 3842 | "required": false, 3843 | "type": "param" 3844 | } 3845 | }, 3846 | "use": "wp widget move", 3847 | "endpoint": true, 3848 | "help": "Move a widget from one position on a sidebar to another." 3849 | }, 3850 | "update": { 3851 | "args": [ 3852 | { 3853 | "required": true, 3854 | "arg": "widget-id", 3855 | "type": "args" 3856 | } 3857 | ], 3858 | "options": { 3859 | "field": { 3860 | "required": false, 3861 | "type": "param" 3862 | } 3863 | }, 3864 | "use": "wp widget update", 3865 | "endpoint": true, 3866 | "help": "Update a given widget's options." 3867 | }, 3868 | "help": "Manage sidebar widgets." 3869 | } 3870 | } -------------------------------------------------------------------------------- /lib/gen-app.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'), _ = require('lodash'), util = require('util'); 2 | 3 | fs.readFile(__dirname + "/cache/scrape.json", "utf8", function (err, data) { 4 | var commands = JSON.parse(data); 5 | 6 | fs.readFile(__dirname + "/gen/overrides.json", "utf8", function (err, data) { 7 | commands = _.merge(commands, JSON.parse(data)); 8 | 9 | commands = function sortCommands(commands) { 10 | var sortable = []; 11 | 12 | if (typeof commands == 'string' || commands instanceof String) return commands; 13 | 14 | for (var vehicle in commands) 15 | sortable.push([vehicle, commands[vehicle]]); 16 | 17 | if (sortable.length == 0) 18 | return commands; 19 | 20 | sortable.sort(function (a, b) { return a[0] < b[0] ? -1 : 1; }); 21 | 22 | var result = {}; 23 | for (var i = 0, kvp; kvp = sortable[i++];) { 24 | result[kvp[0]] = sortCommands(kvp[1]); 25 | } 26 | 27 | return result; 28 | }(commands); 29 | 30 | //oh God how do I do this 31 | 32 | var sub_template = fs.readFileSync(__dirname + "/gen/sub-template", "utf8"); 33 | 34 | var keywords = ["help", "options", "commands"]; 35 | 36 | var result = function buildFile(commands) { 37 | var result = []; 38 | 39 | if (typeof commands == 'string' || commands instanceof String) return [commands]; 40 | 41 | var keys = Object.keys(commands).filter(function (key) { 42 | return !keywords.some(function (k) { 43 | return k == key; 44 | }); 45 | }); 46 | 47 | if (keys.length) { 48 | keys.forEach(function (key) { 49 | result = result.concat(buildFile(commands[key])); 50 | }); 51 | } else { 52 | return keys; 53 | } 54 | 55 | return result; 56 | }(commands); 57 | 58 | var root_template = fs.readFileSync(__dirname + "/gen/main-template", "utf8"); 59 | 60 | var file = util.format(root_template, result.join("\n\n")); 61 | fs.writeFile(__dirname + "/lib/WP.js", file, console.log); 62 | }); 63 | }); -------------------------------------------------------------------------------- /lib/overrides.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } -------------------------------------------------------------------------------- /lib/scrape-commands.js: -------------------------------------------------------------------------------- 1 | //mdrake - better to use CLI dump 2 | var jsdom = require('jsdom'), async = require('async'), _ = require('lodash'); 3 | 4 | var topLevel = function ($, cb) { 5 | subCommand($, cb); 6 | }; 7 | 8 | var commandDetail = function ($, cb) { 9 | if (!cb) cb = function () { }; 10 | 11 | var args = []; 12 | var options = {}; 13 | $("dl dt").each(function () { 14 | /** 15 | * Command Details 16 | */ 17 | var cmd = $(this).text().trim(); 18 | var help = $(this).next("dd").text().trim(); 19 | 20 | var parseFlag = function (cmd) { 21 | var args = cmd.split("="); 22 | var arg = args[1]; 23 | 24 | var flag = args[0].replace(/^--/, ""); 25 | //cmd = {}; 26 | //cmd[flag]=arg||true; 27 | return [flag, arg]; 28 | }; 29 | 30 | var optional = /^\[([^\]]+)\]$/.test(cmd); 31 | var typ = null; 32 | 33 | cmd = cmd.replace(/^\[/, "").replace(/\]$/, "").replace(/[<>]/g, ""); 34 | 35 | if (/^--/.test(cmd)) { 36 | //flag 37 | typ = "flag"; 38 | cmds = parseFlag(cmd); 39 | cmd = cmds[0]; 40 | if (!!cmds[1]) typ = "param"; 41 | options[cmd] = ({ required: !optional, help: help, type: typ }); 42 | } else if (/^([^\u2026]*)\u2026$/.test(cmd)) { 43 | //arg array 44 | typ = "args"; 45 | cmd = cmd.match(/^([^\u2026]*)\u2026$/)[1]; 46 | args.push({ arg: cmd, required: !optional, help: help, type: typ }); 47 | } else { 48 | //arg 49 | typ = "arg"; 50 | cmd = cmd.trim(); 51 | args.push({ arg: cmd, required: !optional, help: help, type: typ }); 52 | } 53 | 54 | console.log("CMD", cmd, optional ? "optional" : "required", help); 55 | //result.push({arg:cmd,required:!optional,help:help,type:typ}); 56 | }); 57 | 58 | var result = { options: options, args: args }; 59 | cb(null, result); 60 | return result; 61 | }; 62 | 63 | var subCommand = function ($, cb) { 64 | var series_seed = {}; 65 | 66 | $("tbody tr").each(function () {//remove eq 0 for prod 67 | /** 68 | * SubCommands 69 | */ 70 | var anch = $("td:eq(0) a", this); 71 | var link = $(anch).attr("href"); 72 | var title = $(anch).text().trim(); 73 | var help = $("td:eq(1)", this).text().trim(); 74 | console.log(title, link, help); 75 | 76 | series_seed[title] = function (cb) { 77 | jsdom.env("http://wp-cli.org" + link, ["http://code.jquery.com/jquery.js"], function (errors, window) { 78 | var $ = window.$; 79 | var result = {}; 80 | if ($("#main_content dl").length) 81 | result = _.merge(commandDetail($), result); 82 | else if (!$("#subcommands").length) { 83 | result.args = []; 84 | result.options = {}; 85 | } 86 | 87 | result.use = $("p code").text().trim(); 88 | $("pre code").each(function () {//should only be one 89 | /** 90 | * Examples 91 | */ 92 | var commands = $(this).text().trim(); 93 | if (commands) { 94 | commands = commands.split('\n').filter(function (c) { return !!c; }); 95 | } else { 96 | commands = []; 97 | } 98 | console.log("Examples", commands); 99 | result.examples = commands; 100 | }); 101 | 102 | if ($("#subcommands").length) { 103 | subCommand($, function (err, commands) { 104 | cb(null, _.merge(commands, result)); 105 | }); 106 | } else { 107 | result.endpoint = true; 108 | cb(null, result); 109 | } 110 | });//subcommand detail jsom 111 | }; 112 | }); 113 | async.series(series_seed, cb); 114 | }; 115 | 116 | jsdom.env("http://wp-cli.org/commands/", ["http://code.jquery.com/jquery.js"], function (errors, window) { 117 | var $ = window.$; 118 | topLevel($, function (err, result) { 119 | console.log("RESULT", result); 120 | require('fs').writeFile(__dirname + "/../cache/scrape.json", JSON.stringify(result, null, 4), function () { 121 | console.log(err || "Success"); 122 | }); 123 | }); 124 | });//command jsdom -------------------------------------------------------------------------------- /lib/utils.js: -------------------------------------------------------------------------------- 1 | var exec = require('child_process').exec, util = require('util'), escapeshellarg = require('escapeshellarg'); 2 | 3 | var isString = function (str) { 4 | return (typeof str == 'string' || str instanceof String); 5 | }; 6 | 7 | module.exports.wp = function (use, args, flags, cb) { 8 | var flagKeys, flagArgs; 9 | 10 | if (!Array.isArray(args)) 11 | args = [args]; 12 | if (!args) 13 | args = []; 14 | args = use.concat(args); 15 | 16 | if (!cb) { 17 | cb = flags; 18 | flags = {}; 19 | } 20 | 21 | if (flags.format) 22 | flags.format = "json"; 23 | 24 | if ((typeof flags == "object") && (flags !== null)) { 25 | flagKeys = Object.keys(flags); 26 | 27 | if (process.getuid && process.getuid() == 0) { 28 | flags["allow-root"] = true;// assuming you know what you're doing here 29 | flagKeys.unshift("allow-root"); 30 | } 31 | 32 | flagArgs = flagKeys.map(function (k) { 33 | if (!Array.isArray(flags[k])) 34 | flags[k] = [flags[k]]; 35 | return flags[k].map(function (flag) { 36 | if (flag === true) 37 | return util.format("--%s", k); 38 | return util.format("--%s=%s", k, escapeshellarg(flag)); 39 | }).join(" "); 40 | }).join(" "); 41 | } else { 42 | flagArgs = '"' + flags + '"'; 43 | } 44 | 45 | var helpIfError = function (e, out) {//this is too verbose - should look into formatting help 46 | if (!e) 47 | return cb(e, out); 48 | /*exec("wp help "+use.join(" "),function(err,stdout,stderr){ 49 | if(!err) 50 | cb(e+"\n\n"+stdout,out); 51 | else 52 | cb(e,out); 53 | });*/ 54 | // shelve this for now 55 | cb(e, out); 56 | }; 57 | 58 | exec("wp " + args.join(" ") + " " + flagArgs, function (err, stdout, stderr) { 59 | if (flags.format == "json" && stdout) { 60 | try { 61 | helpIfError(err || stderr, JSON.parse(stdout)); 62 | } catch (e) { 63 | helpIfError(err || stderr || e, stdout); 64 | } 65 | } else 66 | helpIfError(err || stderr, stdout); 67 | }); 68 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wp-cli", 3 | "version": "0.0.5", 4 | "description": "Node Wrapper for Wordpress CLI", 5 | "main": "index.js", 6 | "scripts": {}, 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/gtg092x/node-wp-cli.git" 10 | }, 11 | "keywords": [ 12 | "wordpress", 13 | "node" 14 | ], 15 | "author": "gtg092x", 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/gtg092x/node-wp-cli/issues" 19 | }, 20 | "homepage": "https://github.com/gtg092x/node-wp-cli", 21 | "devDependencies": { 22 | "request": "^2.34.0", 23 | "jsdom": "^0.10.5", 24 | "async": "^0.8.0", 25 | "lodash": "^2.4.1" 26 | }, 27 | "dependencies": { 28 | "async": "^0.8.0", 29 | "escapeshellarg": "^0.1.0", 30 | "lodash": "^2.4.1" 31 | } 32 | } 33 | --------------------------------------------------------------------------------