CLI_Alias_Command::get()publicWP-CLI 1.0

Gets the value for an alias.

OPTIONS

<key>
Key for the alias.

EXAMPLES

# Get alias.
$ wp cli alias get @prod
ssh: [email protected]:12345/home/dev/

Method of the class: CLI_Alias_Command{}

No Hooks.

Return

null. Nothing (null).

Usage

$CLI_Alias_Command = new CLI_Alias_Command();
$CLI_Alias_Command->get( $args, $assoc_args );
$args (required)
-
$assoc_args (required)
-

CLI_Alias_Command::get() code WP-CLI 2.8.0-alpha

public function get( $args, $assoc_args ) {
	list( $alias ) = $args;

	$aliases = WP_CLI::get_runner()->aliases;

	if ( empty( $aliases[ $alias ] ) ) {
		WP_CLI::error( "No alias found with key '{$alias}'." );
	}

	foreach ( $aliases[ $alias ] as $key => $value ) {
		WP_CLI::log( "{$key}: {$value}" );
	}
}