Removed the default `id` field added to all CLI commands

Some of our endpoints don't have an "<id>" parameter but we're expecting one in the CLI. Since the `id` is already part of the supported IDs we don't actually need this since it will pull it from the route.
This commit is contained in:
Christopher Allford 2020-07-10 14:16:30 -07:00
parent c3618cad47
commit 933cdd7a7b
2 changed files with 2 additions and 9 deletions

View File

@ -113,8 +113,8 @@ class WC_CLI_Runner {
'refund_id' => __( 'Refund ID.', 'woocommerce' ),
'attribute_id' => __( 'Attribute ID.', 'woocommerce' ),
'zone_id' => __( 'Zone ID.', 'woocommerce' ),
'id' => __( 'ID.', 'woocommerce' ),
'instance_id' => __( 'Instance ID.', 'woocommerce' ),
'id' => __( 'The ID for the resource.', 'woocommerce' ),
);
$rest_command->set_supported_ids( $supported_ids );
$positional_args = array_keys( $supported_ids );
@ -167,14 +167,6 @@ class WC_CLI_Runner {
$ids[] = $id_name;
}
}
if ( in_array( $command, array( 'delete', 'get', 'update' ), true ) && ! in_array( 'id', $ids, true ) ) {
$synopsis[] = array(
'name' => 'id',
'type' => 'positional',
'description' => __( 'The id for the resource.', 'woocommerce' ),
'optional' => false,
);
}
foreach ( $endpoint_args as $name => $args ) {
if ( ! in_array( $name, $positional_args, true ) || strpos( $route, '<' . $id_name . '>' ) === false ) {

1
tests/cli/bin/install-package-tests.sh Normal file → Executable file
View File

@ -3,6 +3,7 @@
set -ex
PACKAGE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )"
WP_CLI_BIN_DIR="${PACKAGE_DIR}/bin"
download() {
if [ `which curl` ]; then