@@ -16,17 +16,6 @@ class CLI extends WP_CLI_Command {
1616 /**
1717 * Generate products.
1818 *
19- * ## OPTIONS
20- *
21- * <amount>
22- * : The amount of products to generate
23- * ---
24- * default: 100
25- * ---
26- *
27- * ## EXAMPLES
28- * wc generate products 100
29- *
3019 * @param array $args Arguments specified.
3120 * @param array $assoc_args Associative arguments specified.
3221 */
@@ -59,17 +48,6 @@ public static function products( $args, $assoc_args ) {
5948 /**
6049 * Generate orders.
6150 *
62- * ## OPTIONS
63- *
64- * <amount>
65- * : The amount of orders to generate
66- * ---
67- * default: 100
68- * ---
69- *
70- * ## EXAMPLES
71- * wc generate orders 100
72- *
7351 * @param array $args Arguments specified.
7452 * @param array $assoc_args Associative arguments specified.
7553 */
@@ -78,11 +56,6 @@ public static function orders( $args, $assoc_args ) {
7856
7957 $ time_start = microtime ( true );
8058
81- $ amount = (int ) $ amount ;
82- if ( empty ( $ amount ) ) {
83- $ amount = 100 ;
84- }
85-
8659 if ( ! empty ( $ assoc_args ['status ' ] ) ) {
8760 $ status = $ assoc_args ['status ' ];
8861 if ( ! wc_is_order_status ( 'wc- ' . $ status ) ) {
@@ -111,17 +84,6 @@ public static function orders( $args, $assoc_args ) {
11184 /**
11285 * Generate customers.
11386 *
114- * ## OPTIONS
115- *
116- * <amount>
117- * : The amount of customers to generate
118- * ---
119- * default: 100
120- * ---
121- *
122- * ## EXAMPLES
123- * wc generate customers 100
124- *
12587 * @param array $args Arguments specified.
12688 * @param array $assoc_args Associative arguments specified.
12789 */
@@ -148,17 +110,6 @@ public static function customers( $args, $assoc_args ) {
148110 /**
149111 * Generate coupons.
150112 *
151- * ## OPTIONS
152- *
153- * <amount>
154- * : The amount of coupons to generate
155- * ---
156- * default: 100
157- * ---
158- *
159- * ## EXAMPLES
160- * wc generate coupons 100
161- *
162113 * @param array $args Arguments specified.
163114 * @param array $assoc_args Associative arguments specified.
164115 */
@@ -167,11 +118,6 @@ public static function coupons( $args, $assoc_args ) {
167118
168119 $ time_start = microtime ( true );
169120
170- $ amount = (int ) $ amount ;
171- if ( empty ( $ amount ) ) {
172- $ amount = 10 ;
173- }
174-
175121 $ min = 5 ;
176122 $ max = 100 ;
177123 if ( ! empty ( $ assoc_args ['min ' ] ) ) {
@@ -257,59 +203,84 @@ function () use ( $progress ) {
257203) );
258204
259205WP_CLI ::add_command ( 'wc generate orders ' , array ( 'WC\SmoothGenerator\CLI ' , 'orders ' ), array (
260- 'synopsis ' => array (
206+ 'shortdesc ' => 'Generate orders. ' ,
207+ 'synopsis ' => array (
261208 array (
262- 'name ' => 'amount ' ,
263- 'type ' => 'positional ' ,
264- 'optional ' => true ,
265- 'default ' => 100 ,
209+ 'name ' => 'amount ' ,
210+ 'type ' => 'positional ' ,
211+ 'description ' => 'The number of orders to generate. ' ,
212+ 'optional ' => true ,
213+ 'default ' => 10 ,
266214 ),
267215 array (
268- 'name ' => 'date-start ' ,
269- 'type ' => 'assoc ' ,
270- 'optional ' => true ,
216+ 'name ' => 'date-start ' ,
217+ 'type ' => 'assoc ' ,
218+ 'description ' => 'Randomize the order date using this as the lower limit. Format as YYYY-MM-DD. ' ,
219+ 'optional ' => true ,
271220 ),
272221 array (
273- 'name ' => 'date-end ' ,
274- 'type ' => 'assoc ' ,
275- 'optional ' => true ,
222+ 'name ' => 'date-end ' ,
223+ 'type ' => 'assoc ' ,
224+ 'description ' => 'Randomize the order date using this as the upper limit. Only works in conjunction with date-start. Format as YYYY-MM-DD. ' ,
225+ 'optional ' => true ,
276226 ),
277227 array (
278- 'name ' => 'status ' ,
279- 'type ' => 'assoc ' ,
280- 'optional ' => true ,
228+ 'name ' => 'status ' ,
229+ 'type ' => 'assoc ' ,
230+ 'description ' => 'Specify one status for all the generated orders. Otherwise defaults to a mix. ' ,
231+ 'optional ' => true ,
232+ 'options ' => array ( 'completed ' , 'processing ' , 'on-hold ' , 'failed ' ),
281233 ),
282234 array (
283- 'name ' => 'coupons ' ,
284- 'type ' => 'assoc ' ,
285- 'optional ' => true ,
235+ 'name ' => 'coupons ' ,
236+ 'type ' => 'flag ' ,
237+ 'description ' => 'Create and apply a coupon to each generated order. ' ,
238+ 'optional ' => true ,
286239 ),
287240 ),
241+ 'longdesc ' => "## EXAMPLES \n\nwc generate orders 10 \n\nwc generate orders 50 --date-start=2020-01-01 --date-end=2022-12-31 --status=completed --coupons " ,
288242) );
289243
290- WP_CLI ::add_command ( 'wc generate customers ' , array ( 'WC\SmoothGenerator\CLI ' , 'customers ' ) );
244+ WP_CLI ::add_command ( 'wc generate customers ' , array ( 'WC\SmoothGenerator\CLI ' , 'customers ' ), array (
245+ 'shortdesc ' => 'Generate customers. ' ,
246+ 'synopsis ' => array (
247+ array (
248+ 'name ' => 'amount ' ,
249+ 'type ' => 'positional ' ,
250+ 'description ' => 'The number of customers to generate. ' ,
251+ 'optional ' => true ,
252+ 'default ' => 10 ,
253+ ),
254+ ),
255+ 'longdesc ' => "## EXAMPLES \n\nwc generate customers 10 " ,
256+ ) );
291257
292258WP_CLI ::add_command ( 'wc generate coupons ' , array ( 'WC\SmoothGenerator\CLI ' , 'coupons ' ), array (
293- 'synopsis ' => array (
259+ 'shortdesc ' => 'Generate coupons. ' ,
260+ 'synopsis ' => array (
294261 array (
295- 'name ' => 'amount ' ,
296- 'type ' => 'positional ' ,
297- 'optional ' => true ,
298- 'default ' => 10 ,
262+ 'name ' => 'amount ' ,
263+ 'type ' => 'positional ' ,
264+ 'description ' => 'The number of coupons to generate. ' ,
265+ 'optional ' => true ,
266+ 'default ' => 10 ,
299267 ),
300268 array (
301- 'name ' => 'min ' ,
302- 'optional ' => true ,
303- 'type ' => 'assoc ' ,
304- 'default ' => 5 ,
269+ 'name ' => 'min ' ,
270+ 'type ' => 'assoc ' ,
271+ 'description ' => 'Specify the minimum discount of each coupon. ' ,
272+ 'optional ' => true ,
273+ 'default ' => 5 ,
305274 ),
306275 array (
307- 'name ' => 'max ' ,
308- 'optional ' => true ,
309- 'type ' => 'assoc ' ,
310- 'default ' => 100 ,
276+ 'name ' => 'max ' ,
277+ 'type ' => 'assoc ' ,
278+ 'description ' => 'Specify the maximum discount of each coupon. ' ,
279+ 'optional ' => true ,
280+ 'default ' => 100 ,
311281 ),
312282 ),
283+ 'longdesc ' => "## EXAMPLES \n\nwc generate coupons 10 \n\nwc generate coupons 50 --min=1 --max=50 " ,
313284) );
314285
315286WP_CLI ::add_command ( 'wc generate terms ' , array ( 'WC\SmoothGenerator\CLI ' , 'terms ' ), array (
0 commit comments