src/Role_Command.php
public function list_( $args, $assoc_args ) {
		global $wp_roles;

		$output_roles = array();
		foreach ( $wp_roles->roles as $key => $role ) {
			$output_role = new stdClass();

			$output_role->name = $role['name'];
			$output_role->role = $key;

			$output_roles[] = $output_role;
		}

		$formatter = new Formatter( $assoc_args, $this->fields );
		$formatter->display_items( $output_roles );
	}
public function list_( $args, $assoc_args ) {
		global $wp_roles;

		$output_roles = array();
		foreach ( $wp_roles->roles as $key => $role ) {
			$output_role = new stdClass();

			$output_role->name = $role['name'];
			$output_role->role = $key;

			$output_roles[] = $output_role;
		}

		$formatter = new Formatter( $assoc_args, $this->fields );
		$formatter->display_items( $output_roles );
	}
public function list_ ( $ args , $ assoc_args ) { global $ wp_roles ; $ output_roles = array ( ) ; foreach ( $ wp_roles -> roles as $ key => $ role ) { $ output_role = new stdClass ( ) ; $ output_role -> name = $ role [ 'name' ] ; $ output_role -> role = $ key ; $ output_roles [ ] = $ output_role ; } $ formatter = new Formatter ( $ assoc_args , $ this -> fields ) ; $ formatter -> display_items ( $ output_roles ) ; }
Lists all roles.

## OPTIONS

[--fields=<fields>]
: Limit the output to specific object fields.

[--field=<field>]
: Prints the value of a single field.

[--format=<format>]
: Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- count
- yaml
---

## AVAILABLE FIELDS

These fields will be displayed by default for each role:

* name
* role

There are no optional fields.

## EXAMPLES

# List roles.
$ wp role list --fields=role --format=csv
role
administrator
editor
author
contributor
subscriber

@subcommand list
Lists all roles .