Separate positional and assoc arguments.

This commit is contained in:
Justin Shreve 2017-02-10 08:38:43 -08:00
parent b58e26b0ab
commit 700026c2ab
1 changed files with 12 additions and 8 deletions

View File

@ -92,6 +92,7 @@ class WC_CLI_Runner {
'attribute_id' => __( 'Attribute ID.', 'woocommerce' ),
);
$rest_command->set_supported_ids( $supported_ids );
$positional_args = array_merge( array( 'id' ), array_keys( $supported_ids ) );
$parent = "wc {$route_data['schema']['title']}";
$supported_commands = array();
@ -140,6 +141,7 @@ class WC_CLI_Runner {
'name' => $id_name,
'type' => 'positional',
'description' => $id_desc,
'optional' => false,
);
}
}
@ -154,6 +156,7 @@ class WC_CLI_Runner {
}
foreach ( $endpoint_args as $name => $args ) {
if ( ! in_array( $name, $positional_args ) ) {
$arg_regs[] = array(
'name' => $name,
'type' => 'assoc',
@ -161,6 +164,7 @@ class WC_CLI_Runner {
'optional' => empty( $args['required'] ) ? true : false,
);
}
}
foreach ( $arg_regs as $arg_reg ) {
$synopsis[] = $arg_reg;