|
27 | 27 | class Post_Meta_Command extends CommandWithMeta { |
28 | 28 | protected $meta_type = 'post'; |
29 | 29 |
|
| 30 | + /** |
| 31 | + * List all metadata associated with a post. |
| 32 | + * |
| 33 | + * ## OPTIONS |
| 34 | + * |
| 35 | + * <id> |
| 36 | + * : ID for the post. |
| 37 | + * |
| 38 | + * [--keys=<keys>] |
| 39 | + * : Limit output to metadata of specific keys. |
| 40 | + * |
| 41 | + * [--fields=<fields>] |
| 42 | + * : Limit the output to specific row fields. Defaults to id,meta_key,meta_value. |
| 43 | + * |
| 44 | + * [--format=<format>] |
| 45 | + * : Render output in a particular format. |
| 46 | + * --- |
| 47 | + * default: table |
| 48 | + * options: |
| 49 | + * - table |
| 50 | + * - csv |
| 51 | + * - json |
| 52 | + * - yaml |
| 53 | + * - count |
| 54 | + * --- |
| 55 | + * |
| 56 | + * [--orderby=<fields>] |
| 57 | + * : Set orderby which field. |
| 58 | + * --- |
| 59 | + * default: id |
| 60 | + * options: |
| 61 | + * - id |
| 62 | + * - meta_key |
| 63 | + * - meta_value |
| 64 | + * --- |
| 65 | + * |
| 66 | + * [--order=<order>] |
| 67 | + * : Set ascending or descending order. |
| 68 | + * --- |
| 69 | + * default: asc |
| 70 | + * options: |
| 71 | + * - asc |
| 72 | + * - desc |
| 73 | + * --- |
| 74 | + * |
| 75 | + * [--unserialize] |
| 76 | + * : Unserialize meta_value output. |
| 77 | + * |
| 78 | + * @subcommand list |
| 79 | + * |
| 80 | + * @param array{0: string} $args Positional arguments.. |
| 81 | + * @param array{keys?: string, fields?: string, format: 'table'|'csv'|'json'|'yaml'|'count', orderby: 'id'|'meta_key'|'meta_value', order: 'asc'|'desc', unserialize?: bool} $assoc_args Associative arguments. |
| 82 | + */ |
| 83 | + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Override to provide specific documentation. |
| 84 | + public function list_( $args, $assoc_args ) { |
| 85 | + parent::list_( $args, $assoc_args ); |
| 86 | + } |
| 87 | + |
| 88 | + /** |
| 89 | + * Get meta field value. |
| 90 | + * |
| 91 | + * ## OPTIONS |
| 92 | + * |
| 93 | + * <id> |
| 94 | + * : The ID of the post. |
| 95 | + * |
| 96 | + * <key> |
| 97 | + * : The name of the meta field to get. |
| 98 | + * |
| 99 | + * [--single] |
| 100 | + * : Whether to return a single value. |
| 101 | + * |
| 102 | + * [--format=<format>] |
| 103 | + * : Get value in a particular format. |
| 104 | + * --- |
| 105 | + * default: var_export |
| 106 | + * options: |
| 107 | + * - var_export |
| 108 | + * - json |
| 109 | + * - yaml |
| 110 | + * --- |
| 111 | + * |
| 112 | + * @param array{0: string, 1: string} $args Positional arguments. |
| 113 | + * @param array{single?: bool, format: 'table'|'csv'|'json'|'yaml'} $assoc_args Associative arguments. |
| 114 | + */ |
| 115 | + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Override to provide specific documentation. |
| 116 | + public function get( $args, $assoc_args ) { |
| 117 | + parent::get( $args, $assoc_args ); |
| 118 | + } |
| 119 | + |
| 120 | + /** |
| 121 | + * Delete a meta field. |
| 122 | + * |
| 123 | + * ## OPTIONS |
| 124 | + * |
| 125 | + * <id> |
| 126 | + * : The ID of the post. |
| 127 | + * |
| 128 | + * [<key>] |
| 129 | + * : The name of the meta field to delete. |
| 130 | + * |
| 131 | + * [<value>] |
| 132 | + * : The value to delete. If omitted, all rows with key will deleted. |
| 133 | + * |
| 134 | + * [--all] |
| 135 | + * : Delete all meta for the post. |
| 136 | + * |
| 137 | + * @param array<string> $args Positional arguments. |
| 138 | + * @param array{all?: bool} $assoc_args Associative arguments. |
| 139 | + */ |
| 140 | + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Override to provide specific documentation. |
| 141 | + public function delete( $args, $assoc_args ) { |
| 142 | + parent::delete( $args, $assoc_args ); |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * Add a meta field. |
| 147 | + * |
| 148 | + * ## OPTIONS |
| 149 | + * |
| 150 | + * <id> |
| 151 | + * : The ID of the post. |
| 152 | + * |
| 153 | + * <key> |
| 154 | + * : The name of the meta field to create. |
| 155 | + * |
| 156 | + * [<value>] |
| 157 | + * : The value of the meta field. If omitted, the value is read from STDIN. |
| 158 | + * |
| 159 | + * [--format=<format>] |
| 160 | + * : The serialization format for the value. |
| 161 | + * --- |
| 162 | + * default: plaintext |
| 163 | + * options: |
| 164 | + * - plaintext |
| 165 | + * - json |
| 166 | + * --- |
| 167 | + * |
| 168 | + * @param array<string> $args Positional arguments. |
| 169 | + * @param array{format: 'plaintext'|'json'} $assoc_args Associative arguments. |
| 170 | + */ |
| 171 | + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Override to provide specific documentation. |
| 172 | + public function add( $args, $assoc_args ) { |
| 173 | + parent::add( $args, $assoc_args ); |
| 174 | + } |
| 175 | + |
| 176 | + /** |
| 177 | + * Update a meta field. |
| 178 | + * |
| 179 | + * ## OPTIONS |
| 180 | + * |
| 181 | + * <id> |
| 182 | + * : The ID of the post. |
| 183 | + * |
| 184 | + * <key> |
| 185 | + * : The name of the meta field to update. |
| 186 | + * |
| 187 | + * [<value>] |
| 188 | + * : The new value. If omitted, the value is read from STDIN. |
| 189 | + * |
| 190 | + * [--format=<format>] |
| 191 | + * : The serialization format for the value. |
| 192 | + * --- |
| 193 | + * default: plaintext |
| 194 | + * options: |
| 195 | + * - plaintext |
| 196 | + * - json |
| 197 | + * --- |
| 198 | + * |
| 199 | + * @alias set |
| 200 | + * |
| 201 | + * @param array<string> $args Positional arguments. |
| 202 | + * @param array{format: 'plaintext'|'json'} $assoc_args Associative arguments. |
| 203 | + */ |
| 204 | + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Override to provide specific documentation. |
| 205 | + public function update( $args, $assoc_args ) { |
| 206 | + parent::update( $args, $assoc_args ); |
| 207 | + } |
| 208 | + |
| 209 | + /** |
| 210 | + * Get a nested value from a meta field. |
| 211 | + * |
| 212 | + * ## OPTIONS |
| 213 | + * |
| 214 | + * <id> |
| 215 | + * : The ID of the post. |
| 216 | + * |
| 217 | + * <key> |
| 218 | + * : The name of the meta field to get. |
| 219 | + * |
| 220 | + * <key-path>... |
| 221 | + * : The name(s) of the keys within the value to locate the value to pluck. |
| 222 | + * |
| 223 | + * [--format=<format>] |
| 224 | + * : The output format of the value. |
| 225 | + * --- |
| 226 | + * default: plaintext |
| 227 | + * options: |
| 228 | + * - plaintext |
| 229 | + * - json |
| 230 | + * - yaml |
| 231 | + * --- |
| 232 | + */ |
| 233 | + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Override to provide specific documentation. |
| 234 | + public function pluck( $args, $assoc_args ) { |
| 235 | + parent::pluck( $args, $assoc_args ); |
| 236 | + } |
| 237 | + |
| 238 | + /** |
| 239 | + * Update a nested value for a meta field. |
| 240 | + * |
| 241 | + * ## OPTIONS |
| 242 | + * |
| 243 | + * <action> |
| 244 | + * : Patch action to perform. |
| 245 | + * --- |
| 246 | + * options: |
| 247 | + * - insert |
| 248 | + * - update |
| 249 | + * - delete |
| 250 | + * --- |
| 251 | + * |
| 252 | + * <id> |
| 253 | + * : The ID of the post. |
| 254 | + * |
| 255 | + * <key> |
| 256 | + * : The name of the meta field to update. |
| 257 | + * |
| 258 | + * <key-path>... |
| 259 | + * : The name(s) of the keys within the value to locate the value to patch. |
| 260 | + * |
| 261 | + * [<value>] |
| 262 | + * : The new value. If omitted, the value is read from STDIN. |
| 263 | + * |
| 264 | + * [--format=<format>] |
| 265 | + * : The serialization format for the value. |
| 266 | + * --- |
| 267 | + * default: plaintext |
| 268 | + * options: |
| 269 | + * - plaintext |
| 270 | + * - json |
| 271 | + * --- |
| 272 | + */ |
| 273 | + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Override to provide specific documentation. |
| 274 | + public function patch( $args, $assoc_args ) { |
| 275 | + parent::patch( $args, $assoc_args ); |
| 276 | + } |
| 277 | + |
30 | 278 | /** |
31 | 279 | * Check that the post ID exists |
32 | 280 | * |
|
0 commit comments