New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling an existing command #77

yosymfony opened this Issue Mar 20, 2016 · 0 comments


None yet
1 participant
Copy link

yosymfony commented Mar 20, 2016

If a command plugin depends on another one being run before it, you can use the new CommandEnvironment to run any command registered in Spress. This is useful for creating "meta" commands.

An example of executing the site:build command with --server option:

public function executeCommand(IOInterface $io, array $arguments, array $options)
    $environment = $this->getCommandEnvironment();

    $environment->runCommand('site:build', [
        '--server' => true,

You can also ask if a command exists with hasCommand method:

public function executeCommand(IOInterface $io, array $arguments, array $options)
    $environment = $this->getCommandEnvironment();

    if ($environment->hasCommand('acme')) {
        $environment->runCommand('acme', []);

Additional tasks

yosymfony added a commit that referenced this issue Mar 20, 2016

yosymfony added a commit to spress/ that referenced this issue Mar 25, 2016

@yosymfony yosymfony closed this Mar 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment