From f62a50c6a341f94bfcccde5c579ded1c9340bec4 Mon Sep 17 00:00:00 2001 From: scribu Date: Fri, 4 Oct 2013 14:24:37 +0200 Subject: [PATCH] check response from _parse_name() --- features/upgradables.feature | 4 ++++ php/commands/plugin.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/features/upgradables.feature b/features/upgradables.feature index 56ee10dd..4a21f415 100644 --- a/features/upgradables.feature +++ b/features/upgradables.feature @@ -8,6 +8,10 @@ Feature: Manage WordPress themes and plugins And I run `wp path` And save STDOUT as {CONTENT_DIR} + When I try `wp get ` + Then the return code should be 1 + And STDERR should not be empty + # Install an out of date from WordPress.org repository When I run `wp install --version=` Then STDOUT should contain: diff --git a/php/commands/plugin.php b/php/commands/plugin.php index b2576891..4686b5f6 100644 --- a/php/commands/plugin.php +++ b/php/commands/plugin.php @@ -388,6 +388,9 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { */ public function get( $args, $assoc_args ) { $file = $this->_parse_name( $args[0] ); + if ( !$file ) { + WP_CLI::error( "The '{$args[0]}' plugin could not be found." ); + } $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $file, false, false ); -- 2.11.0