File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 44
55use WP_CLI ;
66use WP_CLI \Entity \RecursiveDataStructureTraverser ;
7+ use WP_CLI \Entity \Utils as EntityUtils ;
78
89/**
910 * Base class for WP-CLI commands that deal with metadata
@@ -396,12 +397,13 @@ public function patch( $args, $assoc_args ) {
396397
397398 if ( 'delete ' == $ action ) {
398399 $ patch_value = null ;
399- } elseif ( Entity \Utils::has_stdin () ) {
400- $ stdin_value = WP_CLI ::get_value_from_arg_or_stdin ( $ args , -1 );
401- $ patch_value = WP_CLI ::read_value ( trim ( $ stdin_value ), $ assoc_args );
402400 } else {
403- // Take the patch value as the last positional argument. Mutates $key_path to be 1 element shorter!
404- $ patch_value = WP_CLI ::read_value ( array_pop ( $ key_path ), $ assoc_args );
401+ $ stdin_value = EntityUtils::has_stdin ()
402+ ? trim ( WP_CLI ::get_value_from_arg_or_stdin ( $ args , -1 ) )
403+ : null ;
404+ $ patch_value = ! empty ( $ stdin_value )
405+ ? WP_CLI ::read_value ( $ stdin_value , $ assoc_args )
406+ : WP_CLI ::read_value ( array_pop ( $ key_path ), $ assoc_args );
405407 }
406408
407409 /* Need to make a copy of $current_meta_value here as it is modified by reference */
You can’t perform that action at this time.
0 commit comments