Example #1
0
}
define('WP_CLI_VERSION', '0.5.0-dev');
// Define the wp-cli location
define('WP_CLI_ROOT', __DIR__ . '/');
// Set a constant that can be used to check if we are running wp-cli or not
define('WP_CLI', true);
// Include the wp-cli classes
include WP_CLI_ROOT . 'class-wp-cli.php';
include WP_CLI_ROOT . 'class-wp-cli-command.php';
include WP_CLI_ROOT . 'class-wp-cli-command-with-upgrade.php';
// Include the command line tools
include WP_CLI_ROOT . '../php-cli-tools/lib/cli/cli.php';
// Register the cli tools autoload
\cli\register_autoload();
// Get the cli arguments
list($arguments, $assoc_args) = WP_CLI::parse_args(array_slice($GLOBALS['argv'], 1));
// Check --silent flag
define('WP_CLI_SILENT', isset($assoc_args['silent']));
// Handle --version parameter
if (isset($assoc_args['version'])) {
    WP_CLI::line('wp-cli ' . WP_CLI_VERSION);
    exit;
}
// Define the WordPress location
if (is_readable($_SERVER['PWD'] . '/../wp-load.php')) {
    define('WP_ROOT', $_SERVER['PWD'] . '/../');
} elseif (!empty($assoc_args['path'])) {
    // trailingslashit() isn't available yet
    define('WP_ROOT', rtrim($assoc_args['path'], '/') . '/');
} else {
    define('WP_ROOT', $_SERVER['PWD'] . '/');