return;
$parser = new \WP_CLI\SynopsisValidator( $synopsis );
+
+ $cmd_path = implode( ' ', get_path( $this ) );
+ foreach ( $parser->get_unknown() as $token ) {
+ \WP_CLI::warning( sprintf(
+ "The `%s` command has an invalid synopsis part: %s",
+ $cmd_path, $token
+ ) );
+ }
+
if ( !$parser->enough_positionals( $args ) ) {
$this->show_usage();
exit(1);
$this->spec = SynopsisParser::parse( $synopsis );
}
+ public function get_unknown() {
+ return array_column( $this->query_spec( array(
+ 'type' => 'unknown',
+ ) ), 'token' );
+ }
+
public function enough_positionals( $args ) {
$positional = $this->query_spec( array(
'type' => 'positional',