public function get( $args, $assoc_args ) {
		$comment_id = (int) $args[0];
		$comment    = get_comment( $comment_id );
		if ( empty( $comment ) ) {
			WP_CLI::error( 'Invalid comment ID.' );
		}

		if ( empty( $assoc_args['fields'] ) ) {
			$comment_array        = get_object_vars( $comment );
			$assoc_args['fields'] = array_keys( $comment_array );
		}

		$formatter = $this->get_formatter( $assoc_args );
		$formatter->display_item( $comment );
	}
public function get( $args, $assoc_args ) {
		$comment_id = (int) $args[0];
		$comment    = get_comment( $comment_id );
		if ( empty( $comment ) ) {
			WP_CLI::error( 'Invalid comment ID.' );
		}

		if ( empty( $assoc_args['fields'] ) ) {
			$comment_array        = get_object_vars( $comment );
			$assoc_args['fields'] = array_keys( $comment_array );
		}

		$formatter = $this->get_formatter( $assoc_args );
		$formatter->display_item( $comment );
	}
public function get ( $ args , $ assoc_args ) { $ comment_id = ( int ) $ args [ 0 ] ; $ comment = get_comment ( $ comment_id ) ; if ( empty ( $ comment ) ) { WP_CLI :: error ( 'Invalid comment ID.' ) ; } if ( empty ( $ assoc_args [ 'fields' ] ) ) { $ comment_array = get_object_vars ( $ comment ) ; $ assoc_args [ 'fields' ] = array_keys ( $ comment_array ) ; } $ formatter = $ this -> get_formatter ( $ assoc_args ) ; $ formatter -> display_item ( $ comment ) ; }
Gets the data of a single comment.

## OPTIONS

<id>
: The comment to get.

[--field=<field>]
: Instead of returning the whole comment, returns the value of a single field.

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

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

## EXAMPLES

# Get comment.
$ wp comment get 21 --field=content
Thanks for all the comments, everyone!
Gets the data of a single comment .