WP_CLI\Dispatcher

get_path()WP-CLI 1.0

Get the path to a command, e.g. "core download"

No Hooks.

Returns

String[].

Usage

get_path( $command );
$command(Subcommand|CompositeCommand) (required)
.

get_path() code WP-CLI 2.13.0-alpha

function get_path( $command ) {
	$path = [];

	do {
		array_unshift( $path, $command->get_name() );
		$command = $command->get_parent();
	} while ( $command );

	return $path;
}