WP_CLI\DocParser::get_arg_args PHP Method

get_arg_args() public method

Get the arguments for a given argument.
public get_arg_args ( string $name ) : mixed | null
$name string Argument's doc name.
return mixed | null
    public function get_arg_args($name)
    {
        return $this->get_arg_or_param_args("/^\\[?<{$name}>.*/");
    }

Usage Example

Example #1
0
    public function test_desc_parses_yaml()
    {
        $longdesc = <<<EOB
## OPTIONS

<genre>...
: Start with one or more genres.
---
options:
  - rock
  - electronic
default: rock
---

--volume=<number>
: Sets the volume.
---
default: 10
---

--artist=<artist-name>
: Limit to a specific artist.

## EXAMPLES

wp rock-on electronic --volume=11

EOB;
        $doc = new DocParser($longdesc);
        $this->assertEquals('Start with one or more genres.', $doc->get_arg_desc('genre'));
        $this->assertEquals('Sets the volume.', $doc->get_param_desc('volume'));
        $this->assertEquals(array('options' => array('rock', 'electronic'), 'default' => 'rock'), $doc->get_arg_args('genre'));
        $this->assertEquals(array('default' => 10), $doc->get_param_args('volume'));
        $this->assertNull($doc->get_param_args('artist'));
    }
All Usage Examples Of WP_CLI\DocParser::get_arg_args