private $when_invoked;
+ private $prompt = false;
+
function __construct( $parent, $name, $docparser, $when_invoked ) {
$this->when_invoked = $when_invoked;
return $this->alias;
}
+ function set_prompt( $value ) {
+ $this->prompt = (bool)$value;
+ }
+
+ function get_prompt() {
+ return $this->prompt;
+ }
+
function show_usage( $prefix = 'usage: ' ) {
\WP_CLI::line( sprintf( "%s%s %s",
$prefix,
function invoke( $args, $assoc_args ) {
- if ( ! empty( $assoc_args['prompt'] ) )
+ if ( $this->get_prompt() )
list( $args, $assoc_args ) = $this->prompt_args( $args, $assoc_args );
$this->validate_args( $args, $assoc_args );
self::set_url_params( $url_parts );
}
+ // Handle --prompt parameter
+ if ( $this->config['prompt'] ) {
+ $r = $this->find_command_to_run( $this->arguments );
+ if ( is_array( $r ) ) {
+ list( $command ) = $r;
+ $command->set_prompt( true );
+ }
+ }
+
$this->do_early_invoke( 'before_wp_load' );
$this->check_wp_version();
'desc' => 'Show all PHP errors',
),
+ 'prompt' => array(
+ 'runtime' => '',
+ 'file' => false,
+ 'default' => false,
+ 'desc' => 'Prompt the user to enter values for all command arguments',
+ ),
+
'quiet' => array(
'runtime' => '',
'file' => '<bool>',