# wp-cli command options gotcha

A quick wp-cli command gotcha.

## Command flags

wp-cli allows for very flexible and powerful commands to be put in place and its cookbook does a good job of going over the possibilities offered to package developers.
But I’ll admit I’ve skimmed the cookbook to jump into the code to the point that I’ve missed the “--no-option cast” completely.

## An example

In the code I’m working on the user can tell the command it should not ask any question and go straight through the default installation, to do so the user should use the --no-install flag:

wp wpb-scaffold plugin-tests --no-interactive

To support the option I’ve updated the command registration like this:

<?php

if ( ! class_exists( 'WP_CLI' ) ) {
return;
}

'shortdesc' => 'Scaffolds wp-browser based tests for a plugin or theme',
'synopsis'  => array(
array(
'type'     => 'positional',
'name'     => 'subcommand',
'optional' => false,
'multiple' => false,
),
array(
'type'     => 'positional',
'name'     => 'slug',
'optional' => true,
'multiple' => false,
),
array(
'type'     => 'flag',
'name'     => 'dry-run',
'optional' => true,
),
array(
'type'     => 'flag',
'name'     => 'no-install',
'optional' => true,
),
// [more options]...
)
) );

But when running the Behat tests I kept seeing an error about the --no-install flag: